Skip to content

Commit e7be045

Browse files
Address feedback
1 parent 19b25db commit e7be045

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

rails/ai-rules/rules/controllers.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Controllers
22

33
- Controllers handle HTTP only: receive request, delegate to model, return response.
4+
- Avoid long actions, since they often signal business logic that belongs in a model or PORO.
45
- Maximum one instance variable per action.
56
- No business logic, calculations, email sending, or multi-object operations in controllers.
67
- Return `status: :unprocessable_entity` on failed form renders (required by Turbo).

rails/ai-rules/rules/models.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Name classes after domain nouns, not actions. No `*Service`, `*Manager`, `*Handler` suffixes.
55
- Use `ActiveModel::Model` for POROs that need validation or form integration.
66
- Replace `.call` / `.perform` with domain verbs: `#save`, `#complete`, `#submit`, `#deliver`.
7+
- Look to identify domain models that can be extracted when an existing model is large.
78
- Callbacks only for data integrity (normalise fields, set defaults). Never for emails, payments, or external systems.
89
- Prefer composition over inheritance. Extract behaviour into small, focused objects.
9-
- Avoid feature envy, case statements on type, and mixin abuse.
10+
- Avoid feature envy, long parameter lists, case statements on type, and mixin abuse.

0 commit comments

Comments
 (0)