Module: Squeel::Adapters::ActiveRecord::Preloader

Defined in:
lib/squeel/adapters/active_record/preloader.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.rb', line 6

def self.included(base)
  base.class_eval do
    alias_method_chain :run, :squeel
  end
end

Instance Method Details

#run_with_squeelObject



12
13
14
15
16
# File 'lib/squeel/adapters/active_record/preloader.rb', line 12

def run_with_squeel
  unless records.empty?
    Visitors::SymbolVisitor.new.accept(associations).each { |association| preload(association) }
  end
end