Sha256: 94bbee49e08886be8b93bbc2d9e30233d931f1c805ca284becf46b5d34fc8fe4
Contents?: true
Size: 966 Bytes
Versions: 31
Compression:
Stored size: 966 Bytes
Contents
module ActiveRecord module Associations class HasManyThroughAssociation def through_records_for(record) # CPK # attributes = construct_join_attributes(record) # candidates = Array.wrap(through_association.target) # candidates.find_all do |c| # attributes.all? do |key, value| # c.public_send(key) == value # end # end if record.composite? candidates = Array.wrap(through_association.target) candidates.find_all { |c| c.attributes.slice(*source_reflection.association_primary_key) == record.ids_hash } else attributes = construct_join_attributes(record) candidates = Array.wrap(through_association.target) candidates.find_all do |c| attributes.all? do |key, value| c.public_send(key) == value end end end end end end end
Version data entries
31 entries across 31 versions & 1 rubygems