Class: ActiveRecord::Associations::JoinDependency::JoinAssociation
- Inherits:
-
Object
- Object
- ActiveRecord::Associations::JoinDependency::JoinAssociation
- Defined in:
- lib/composite_primary_keys/associations/join_dependency/join_association.rb
Instance Method Summary collapse
Instance Method Details
#build_constraint(reflection, table, key, foreign_table, foreign_key) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/composite_primary_keys/associations/join_dependency/join_association.rb', line 5 def build_constraint(reflection, table, key, foreign_table, foreign_key) # CPK # constraint = table[key].eq(foreign_table[foreign_key]) constraint = cpk_join_predicate(table, key, foreign_table, foreign_key) if reflection.klass.finder_needs_type_condition? constraint = table.create_and([ constraint, reflection.klass.send(:type_condition, table) ]) end constraint end |