Class: ActiveRecord::Associations::HasManyThroughAssociation
- Inherits:
-
Object
- Object
- ActiveRecord::Associations::HasManyThroughAssociation
- Defined in:
- lib/composite_primary_keys/associations/has_many_through_association.rb
Instance Method Summary collapse
Instance Method Details
#cpk_join_through_predicate(*records) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/composite_primary_keys/associations/has_many_through_association.rb', line 4 def cpk_join_through_predicate(*records) ensure_mutable ids = records.map do |record| source_reflection.association_primary_key(reflection.klass).map do |key| record.send(key) end end cpk_in_predicate(through_association.scope.klass.arel_table, source_reflection.foreign_key, ids) end |