Sha256: 92cc49bee6fdf3dd2777b09adea04aa28c01a3f7b575a609f7ace11dbf0247bb

Contents?: true

Size: 439 Bytes

Versions: 5

Compression:

Stored size: 439 Bytes

Contents

# frozen_string_literal: true

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`.'.freeze

        def on_send(node)
          return unless node.command?(:has_and_belongs_to_many)

          add_offense(node, :selector)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubocop-0.50.0 lib/rubocop/cop/rails/has_and_belongs_to_many.rb
rubocop-0.49.1 lib/rubocop/cop/rails/has_and_belongs_to_many.rb
rubocop-0.49.0 lib/rubocop/cop/rails/has_and_belongs_to_many.rb
rubocop-0.48.1 lib/rubocop/cop/rails/has_and_belongs_to_many.rb
rubocop-0.48.0 lib/rubocop/cop/rails/has_and_belongs_to_many.rb