- Avoid
member
andcollection
routes. - Use private instead of protected when defining controller methods.
- Name date columns with
_on
suffixes. - Name datetime columns with
_at
suffixes. - Name time columns (referring to a time of day with no date) with
_time
suffixes. - Name initializers for their gem name.
- Order ActiveRecord associations alphabetically by association type, then attribute name. Example.
- Order ActiveRecord validations alphabetically by attribute name.
- Order ActiveRecord associations above ActiveRecord validations.
- Order controller contents: filters, public methods, private methods.
- Order i18n translations alphabetically by key name.
- Order model contents: constants, macros, public methods, private methods.
- Put application-wide partials in the
app/views/application
directory. - Use
def self.method
, not thescope :method
DSL. - Use the default
render 'partial'
syntax overrender partial: 'partial'
. - Use
link_to
for GET requests, andbutton_to
for other HTTP verbs. - Use new-style
validates :name, presence: true
validations, and put all validations for a given column together. Example.
- Set an empty string as the default constraint for non-required string and text fields. Example.
- Avoid the
:except
option in routes. - Order resourceful routes alphabetically by name.
- Use the
:only
option to explicitly state exposed routes.
- Define a
PRIORITY
constant at the top of delayed job classes. - Define two public methods:
self.enqueue
andperform
. - Put delayed job classes in
app/jobs
.
- Use the user's name in the
From
header and email in theReply-To
when delivering email on behalf of the app's users.