Module: Polyamorous::ReflectionExtensions

Defined in:
lib/polyamorous/activerecord_5.2_ruby_2/reflection.rb

Instance Method Summary collapse

Instance Method Details

#build_join_constraint(table, foreign_table) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/polyamorous/activerecord_5.2_ruby_2/reflection.rb', line 3

def build_join_constraint(table, foreign_table)
  if polymorphic?
    super(table, foreign_table)
    .and(foreign_table[foreign_type].eq(klass.name))
  else
    super(table, foreign_table)
  end
end