Class: RuboCop::Cop::Rails::ModelAssociationScattering
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Rails::ModelAssociationScattering
- Defined in:
- lib/rubocop/cop/rails/model_association_scattering.rb
Constant Summary collapse
- MSG =
'Group all associations together without non-association code scattered between them.'- ASSOCIATION_METHODS =
[ :belongs_to, :has_one, :has_many, :has_and_belongs_to_many ].freeze
Instance Method Summary collapse
Instance Method Details
#on_class(node) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/rubocop/cop/rails/model_association_scattering.rb', line 15 def on_class(node) return unless model_class?(node) associations = find_associations(node) return if associations.empty? check_association_scattering(associations, node) end |