Class: Jat::Plugins::BaseActiverecordPreloads::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/jat/plugins/base/base_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



25
26
27
28
29
30
31
# File 'lib/jat/plugins/base/base_activerecord_preloads/lib/preloader.rb', line 25

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