Add note on CRUD controllers

This commit is contained in:
Jorge Manrubia
2025-11-28 09:10:00 +01:00
parent c87f8a87f5
commit d836a1c6c7
+16
View File
@@ -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