Ruby Rails Application

aj-geddes/useful-ai-prompts/skills/ruby-rails-application

作者 aj-geddes3f5182cfd739無授權條款355 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫7 個月前更新

Develop Ruby on Rails applications with models, controllers, views, Active Record ORM, authentication, and RESTful routes. Use when building Rails applications, managing database relationships, and implementing MVC architecture.

AI 產生的概覽

指導建置 Ruby on Rails 應用程式,涵蓋 Active Record 模型、RESTful 控制器、JWT 驗證與資料庫遷移。

功能
提供開發 Ruby on Rails 應用程式的參考指南與慣例,涵蓋專案初始化、Active Record 模型與關聯、資料庫遷移、RESTful 控制器、JWT 驗證、Active Record 查詢以及序列化器。此技能也附帶一個結構描述驗證指令碼和一個遷移範本。產出的是 Rails 程式碼的指引與雛型,而非完整應用程式。
適用情境
適用於建置或擴充 Rails 網頁應用程式、定義模型關聯、撰寫資料庫遷移、建立 RESTful 控制器,或加入以 JWT 為基礎的驗證時。對象是遵循 Rails 慣例的開發者。
執行需求
需要 Ruby on Rails 執行環境以及 PostgreSQL 等資料庫,並能執行 Rails 指令。此技能附帶一個可執行的 shell 指令碼和一個 SQL 遷移範本。

Ruby Rails Application

Table of Contents

Overview

Build comprehensive Ruby on Rails applications with proper model associations, RESTful controllers, Active Record queries, authentication systems, middleware chains, and view rendering following Rails conventions.

When to Use

  • Building Rails web applications
  • Implementing Active Record models with associations
  • Creating RESTful controllers and actions
  • Integrating authentication and authorization
  • Building complex database relationships
  • Implementing Rails middleware and filters

Quick Start

Minimal working example:

bash
rails new myapp --api --database=postgresqlcd myapprails db:create

Reference Guides

Detailed implementations in the references/ directory:

GuideContents
Rails Project Setup [blocked]Rails Project Setup
Models with Active Record [blocked]Models with Active Record
Database Migrations [blocked]Database Migrations
Controllers with RESTful Actions [blocked]Controllers with RESTful Actions
Authentication with JWT [blocked]Authentication with JWT
Active Record Queries [blocked]Active Record Queries
Serializers [blocked]Serializers

Best Practices

✅ DO

  • Use conventions over configuration
  • Leverage Active Record associations
  • Implement proper scopes for queries
  • Use strong parameters for security
  • Implement authentication in ApplicationController
  • Use services for complex business logic
  • Implement proper error handling
  • Use database migrations for schema changes
  • Validate all inputs at model level
  • Use before_action filters appropriately

❌ DON'T

  • Use raw SQL without parameterization
  • Implement business logic in controllers
  • Trust user input without validation
  • Store secrets in code
  • Use select * without specifying columns
  • Forget N+1 query problems (use includes/joins)
  • Implement authentication in each controller
  • Use global variables
  • Ignore database constraints

來源與署名

來源:aj-geddes/useful-ai-prompts位於skills/ruby-rails-application提交3f5182c

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架