Class: Rubocop::Cop::Rails::HasAndBelongsToMany
- Defined in:
- lib/rubocop/cop/rails/has_and_belongs_to_many.rb
Overview
This cop checks for the use of the has_and_belongs_to_many macro.
Constant Summary collapse
- MSG =
'Prefer has_many :through to has_and_belongs_to_many.'
Constants inherited from Cop
Instance Attribute Summary
Attributes inherited from Cop
#config, #corrections, #offences, #processed_source
Instance Method Summary collapse
Methods inherited from Cop
#add_offence, all, #autocorrect?, #convention, #cop_config, cop_name, #cop_name, cop_type, #debug?, #ignore_node, inherited, #initialize, lint?, #message, non_rails, rails?, style?, #support_autocorrect?, #warning
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#on_send(node) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/rubocop/cop/rails/has_and_belongs_to_many.rb', line 10 def on_send(node) receiver, method_name, *_args = *node if receiver.nil? && method_name == :has_and_belongs_to_many convention(node, :selector) end end |