Module: Squeel::Adapters::ActiveRecord::PreloaderExtensions
- Defined in:
- lib/squeel/adapters/active_record/preloader_extensions.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
6 7 8 9 10 |
# File 'lib/squeel/adapters/active_record/preloader_extensions.rb', line 6 def self.included(base) base.class_eval do alias_method_chain :run, :squeel end end |
Instance Method Details
#run_with_squeel ⇒ Object
12 13 14 15 16 |
# File 'lib/squeel/adapters/active_record/preloader_extensions.rb', line 12 def run_with_squeel unless records.empty? Visitors::PreloadVisitor.new.accept(associations).each { |association| preload(association) } end end |