Module: Polyamorous::ReflectionExtensions

Defined in:
lib/polyamorous/activerecord/reflection.rb

Instance Method Summary collapse

Instance Method Details

#join_scope(table, foreign_table, foreign_klass) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/polyamorous/activerecord/reflection.rb', line 3

def join_scope(table, foreign_table, foreign_klass)
 if respond_to?(:polymorphic?) && polymorphic?
    super.where!(foreign_table[foreign_type].eq(klass.name))
  else
    super
  end
end