Module: Preload::ArrayMixin
- Defined in:
- lib/preload/array_mixin.rb
Instance Method Summary collapse
Instance Method Details
#preload(*associations) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/preload/array_mixin.rb', line 5 def preload(*associations) return if empty? if defined?(ActiveRecord::Associations::Preloader) ActiveRecord::Associations::Preloader.new(self, associations).run elsif ActiveRecord::Base.respond_to?(:preload_associations, true) first.class.send(:preload_associations, self, associations) else raise "Unsupported version of ActiveRecord" end end |