Conversation
| * Avoid ActiveRecord callbacks where possible, prefer Service Objects architecture to store any business | ||
| * Order associations, scopes and validations alphabetically | ||
| * Aim to remove business logic that is not directly related to reading from or writing to the database | ||
| * `Scopes` vs `Class methods`. Use scopes when the logic is very small, for simple where/order clauses, |
There was a problem hiding this comment.
We have Query Objects for complex queries, sqls, and "scopes" - https://github.com/ergoserv/handbook/blob/master/guides/query_objects.md.
I'd suggest to use them instead of Class methods. What do you think?
| end | ||
| end | ||
|
|
||
| # app/models/concerns/commentable |
There was a problem hiding this comment.
Seems the file extenstion is missing.
|
|
||
| # app/models/concerns/commentable | ||
| module Commentable | ||
| # Concern should be named with `able` prefix |
There was a problem hiding this comment.
I'd suggest moving this message to the line about the concerns above (in Key Points section) or add a Conventions (like in some other articles - https://github.com/ergoserv/handbook/blob/master/guides/query_objects.md#conventions).
| module Commentable | ||
| # Concern should be named with `able` prefix | ||
| extend ActiveSupport::Concern | ||
| # EXTENDing is required |
There was a problem hiding this comment.
Probably we can omit this comment because this is known from the official Rails guides. You may add a link to concerns guide page somewhere instead.
No description provided.