Class: ArLazyPreload::Contexts::BaseContext

Inherits:
Object
  • Object
show all
Defined in:
lib/motor/active_record_utils/ar_lazy_preload_patch.rb

Instance Method Summary collapse

Instance Method Details

#preload_records(association_name, records) ⇒ Object



24
25
26
27
28
29
# File 'lib/motor/active_record_utils/ar_lazy_preload_patch.rb', line 24

def preload_records(association_name, records)
  TemporaryPreloadConfig.within_context do
    ActiveRecord::Associations::Preloader.new(records: records,
                                              associations: association_name).call
  end
end