class Gitlab::Styles::Rubocop::Cop::PolymorphicAssociations
Cop
that prevents the use of polymorphic associations
Constants
- MSG
Public Instance Methods
on_send(node)
click to toggle source
# File lib/gitlab/styles/rubocop/cop/polymorphic_associations.rb, line 15 def on_send(node) return unless in_model?(node) return unless node.children[1] == :belongs_to node.children.last.each_node(:pair) do |pair| key_name = pair.children[0].children[0] add_offense(pair) if key_name == :polymorphic end end