rails-concern
Installation
SKILL.md
Rails Concern Generator (TDD)
Creates concerns (ActiveSupport::Concern modules) for shared behavior with specs first.
Quick Start
- Write failing spec testing the concern behavior
- Run spec to confirm RED
- Implement concern in
app/models/concerns/orapp/controllers/concerns/ - Run spec to confirm GREEN
When to Use Concerns
Good use cases:
- Shared validations across multiple models
- Common scopes used by several models
- Shared callbacks (e.g., UUID generation)
- Controller authentication/authorization helpers
- Pagination or filtering logic
Related skills