Sha256: e3c44d71c3dfec1383b88227f7f0bb0a4b49a4083c3c837136692f3eecaf6e28

Contents?: true

Size: 485 Bytes

Versions: 5

Compression:

Stored size: 485 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    module Rails
      # This cop checks for the use of the has_and_belongs_to_many macro.
      class HasAndBelongsToMany < Cop
        MSG = 'Prefer has_many :through to has_and_belongs_to_many.'

        def on_send(node)
          receiver, method_name, *_args = *node

          if receiver.nil? && method_name == :has_and_belongs_to_many
            convention(node, :selector)
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubocop-0.15.0 lib/rubocop/cop/rails/has_and_belongs_to_many.rb
rubocop-0.14.1 lib/rubocop/cop/rails/has_and_belongs_to_many.rb
rubocop-0.14.0 lib/rubocop/cop/rails/has_and_belongs_to_many.rb
rubocop-0.13.1 lib/rubocop/cop/rails/has_and_belongs_to_many.rb
rubocop-0.13.0 lib/rubocop/cop/rails/has_and_belongs_to_many.rb