Class: ActiveRecord::Associations::Preloader::Association::LoaderQuery
- Inherits:
-
Object
- Object
- ActiveRecord::Associations::Preloader::Association::LoaderQuery
- Defined in:
- lib/composite_primary_keys/associations/preloader/association.rb
Instance Method Summary collapse
Instance Method Details
#load_records_for_keys(keys, &block) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/composite_primary_keys/associations/preloader/association.rb', line 7 def load_records_for_keys(keys, &block) # CPK if association_key_name.is_a?(Array) predicate = cpk_in_predicate(scope.klass.arel_table, association_key_name, keys) scope.where(predicate).load(&block) else scope.where(association_key_name => keys).load(&block) end end |