From d836a1c6c78c1056caa2b2e9cc9895c4d86618cd Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Fri, 28 Nov 2025 09:10:00 +0100 Subject: [PATCH] Add note on CRUD controllers --- STYLE.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/STYLE.md b/STYLE.md index 498a8e720..196551ba6 100644 --- a/STYLE.md +++ b/STYLE.md @@ -135,6 +135,22 @@ class SomeModule end ``` +## CRUD controllers + +We model web endpoints as CRUD operations on resources (REST). When an action doesn't map cleanly to a standard CRUD verb, we introduce a new resource rather than adding custom actions. + +```ruby +# Bad +resources :cards do + post :close + post :reopen +end + +# Good +resources :cards do + resource :closure +end +``` ## Controller and model interactions