class RuboCop::Cop::Rails::HasAndBelongsToMany
This cop checks for the use of the has_and_belongs_to_many macro.
@example
# bad # has_and_belongs_to_many :ingredients # good # has_many :ingredients, through: :recipe_ingredients
Constants
- MSG
- RESTRICT_ON_SEND
Public Instance Methods
on_send(node)
click to toggle source
# File lib/rubocop/cop/rails/has_and_belongs_to_many.rb, line 18 def on_send(node) return unless node.command?(:has_and_belongs_to_many) add_offense(node.loc.selector) end