Module: Autobots::Helpers::ActiveRecordPreloading

Extended by:
ActiveSupport::Concern
Included in:
ActiveRecordAssembler
Defined in:
lib/autobots/helpers/active_record_preloading.rb

Instance Method Summary collapse

Instance Method Details

#transform(objects) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/autobots/helpers/active_record_preloading.rb', line 11

def transform(objects)
  ActiveRecord::Associations::Preloader.new(objects, preloads).run
  objects
rescue ArgumentError
  ActiveRecord::Associations::Preloader.new.preload(objects, preloads)
  objects
end