vanilla-rails-controllers

Convert Rails state transitions into resource-based controllers with model delegation.

3|Updated Dec 25, 2025
One-click install
npx skills add https://github.com/ZempTime/zemptime-marketplace --skill vanilla-rails-controllers
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vanilla-rails-controllers
Source: https://github.com/ZempTime/zemptime-marketplace/tree/main/vanilla-rails/skills/controllers
Command: npx skills add https://github.com/ZempTime/zemptime-marketplace --skill vanilla-rails-controllers

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Rails projects often accumulate ad hoc controller actions that mutate model state. This skill advocates treating state transitions as distinct resources, guiding you to extract state logic into resource-based controllers and keep business logic in models.

Core Features & Use Cases

  • Resource-based state changes: convert each state transition (close, archive, publish, assign) into its own controller resource.
  • Clear separation: controllers delegate to well-named model methods, reducing fat controllers and duplicated logic.
  • Consistent routing patterns: use singular or plural resources to represent entering and leaving a state, with straightforward testability.

Quick Start

Define a new state resource for a model (for example, a closure state for a Card), add a matching controller under Cards::ClosuresController, and implement create to enter the state and destroy to leave it by invoking the corresponding model methods.

Frequently Asked Questions about vanilla-rails-controllers

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

FAQPage Schema
How do I handle Rails controller state changes without creating ad hoc actions?

Rails controller state changes are handled by treating transitions as distinct resources. You extract state logic into dedicated resource controllers and delegate business logic to model methods, following the 37signals resource pattern.

What is the resource pattern for Rails controller state transitions?

The resource pattern models state transitions as separate controllers. Each transition becomes a resource with create to enter the state and destroy to leave it, ensuring consistent routing and clear separation from business logic.

How do I structure routes for Rails state change resources like archive or publish?

Routes for Rails state change resources use standard singular or plural resources. You map create actions to enter states and destroy actions to leave them, matching the transition resource to straightforward testability.

Can I use this Rails controller pattern with existing models and no external dependencies?

Yes, this Rails controller pattern requires no external runtime dependencies beyond Rails itself. It applies across existing controllers, routes, and models by delegating state transitions to well-named model methods.

When should I extract a state transition into its own Rails controller resource?

Extract a state transition into its own Rails controller resource whenever a model needs a state change like close, archive, publish, or assign. This reduces fat controllers and duplicated logic by standardizing the design.