Edited this old question to include the answer below: Rubocop has it https://github.com/rubocop-hq/rails-style-guide#macro-style-methods
Rails is the “Configuration Agreement”. However, I have not yet met a "standard" for the order of associations, scopes, inclusions, checks ... in Rails models. Take, for example, the following simplified product model:
class Product < ActiveRecord::Base mount_uploader :logo, AssetUploader acts_as_taggable paginates_per 50 include ActionView::Helpers::NumberHelper belongs_to :company validates_presence_of [:title, :price, :plu] scope :on_website, where(display: true) def display_price ... end end
Is this the correct order? Maybe this is not so important for many people, but I personally think that it would be great if there was an agreement on this issue.
source share