What problem does it solve?
This skill provides concise, pragmatic guidance for designing, implementing, and maintaining Rails controller actions and routing so developers avoid inconsistent endpoints, insecure parameter handling, and fragile response behavior.
Core Features & Use Cases
- RESTful Controller Patterns: Clear conventions for resourceful routes, member and collection actions, shallow nesting, and namespacing.
- Action Structure & Filters: Recommendations for before_action/after_action usage, controller concerns, and keeping controllers thin by delegating business logic to services or models.
- Request Handling & Responses: Best practices for strong parameter whitelisting, session and cookie usage, error handling with rescue_from, and responding to HTML and JSON clients.
- Use Case: Refactor a PostsController to follow REST conventions, add strong parameters, authorize edits, and support both HTML views and JSON APIs with proper status codes.
Quick Start
Ask the skill to generate a RESTful PostsController with index, show, create, update, and destroy actions using strong parameters, before_action setup, and HTML/JSON responses.