Class: Serega::SeregaPlugins::ActiverecordPreloads::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/serega/plugins/activerecord_preloads/lib/preloader.rb

Class Method Summary collapse

Class Method Details

.call(records, associations) ⇒ Object

:nocov: We can check only one version of activerecord



32
33
34
35
36
37
38
# File 'lib/serega/plugins/activerecord_preloads/lib/preloader.rb', line 32

def self.call(records, associations)
  if ActiveRecord::VERSION::MAJOR >= 7
    ActiveRecord::Associations::Preloader.new(records: records, associations: associations).call
  else
    ActiveRecord::Associations::Preloader.new.preload(records, associations)
  end
end