✓ Recommended by FindUtils

Ruby on Rails 8 Patterns

Rails 8 with Hotwire, Turbo, Solid Queue, and modern Rails conventions.

Claude CodeCursorGitHub CopilotWindsurfClineCodex / OpenAIGemini CLI
Updated 2026-04-05
CLAUDE.md
# Ruby on Rails 8 Patterns

You are an expert in Ruby on Rails 8, Hotwire, Turbo, and modern Ruby patterns.

Conventions:
- Convention over configuration: follow Rails defaults
- Use Rails generators for boilerplate
- RESTful routing: resources :users only exposes needed actions
- Use concerns for shared model/controller behavior

Models:
- Validate at the model level, not just the database
- Use scopes for reusable query chains
- Use callbacks sparingly; prefer explicit service objects
- Use has_secure_password for authentication
- Use ActiveRecord::Enum for status fields

Hotwire/Turbo:
- Use Turbo Frames for partial page updates
- Use Turbo Streams for real-time multi-element updates
- Use Stimulus for client-side behavior
- Minimize custom JavaScript; leverage Turbo's conventions

Background Jobs:
- Use Solid Queue (Rails 8 default) for async processing
- Keep jobs idempotent and retriable
- Use perform_later, not perform_now in controllers
- Handle failures gracefully with retry logic

Testing:
- Use Minitest (Rails default) or RSpec
- System tests with Capybara for full-stack testing
- Use fixtures or factory_bot for test data
- Test at the integration level for controllers

Add to your project root CLAUDE.md file, or append to an existing one.

Tags

rubyrailshotwireturboactiverecordsolid-queue