controllers

Generate Rails RESTful controllers with nested resources and strong parameters.

Updated Dec 13, 2024
One-click install
npx skills add https://github.com/apdarr/lace --skill controllers-apdarr
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: controllers
Source: https://github.com/apdarr/lace/tree/main/.github/skills/controllers
Command: npx skills add https://github.com/apdarr/lace --skill controllers-apdarr

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Rails controllers often accumulate business logic, making maintenance hard and tests brittle; this Skill promotes skinny controllers by guiding RESTful structure, nested resources, reusable concerns, and strict parameter handling.

Core Features & Use Cases

  • Enforces the seven standard RESTful actions: index, show, new, create, edit, update, destroy
  • Supports nested resources and shallow routing to keep routes readable
  • Encourages concerns and services to encapsulate business logic and keep controllers thin
  • Enforces strong parameters for mass assignment protection to improve security and stability

Quick Start

Create a new Rails controller implementing the seven RESTful actions and apply strong parameters to protect against mass assignment.

Frequently Asked Questions about controllers

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build skinny Rails controllers with strong parameters?

To build skinny Rails controllers, delegate business logic to models or services and enforce strong parameters for mass assignment protection. This approach ensures controllers remain lean by strictly handling routing and HTTP requests.

How do I set up nested resources with shallow routing in a Rails API?

Setting up nested resources with shallow routing in a Rails API keeps routes readable while standardizing the seven RESTful actions. This structure prevents deeply nested URL paths and maintains clean resource associations.

Why do my Rails controllers accumulate business logic and become hard to maintain?

Rails controllers accumulate business logic when they fail to delegate to models or services, making maintenance hard and tests brittle. Enforcing a thin controller design pattern with standardized RESTful actions resolves this.

Does this approach support the seven standard RESTful actions for multi-resource web applications?

Yes, this approach supports the seven standard RESTful actions for multi-resource web applications. It automates the creation of index, show, new, create, edit, update, and destroy actions to maintain consistent API design.

What is the best way to enforce mass assignment protection in Ruby on Rails?

The best way to enforce mass assignment protection in Ruby on Rails is by applying strong parameters within your controllers. This secures your application by explicitly defining permitted attributes for each RESTful action.