diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-11-18 14:22:33 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-11-18 14:22:33 -0800 |
commit | 78e7a0d3b7eaafe1ad0a45e3e355e1123cae3f8b (patch) | |
tree | 059907c70b5faac429e65c942bd32cf938425b03 /activerecord | |
parent | 52fddcc653458456f98b3683dffd781cf00b35fe (diff) | |
download | rails-78e7a0d3b7eaafe1ad0a45e3e355e1123cae3f8b.tar.gz rails-78e7a0d3b7eaafe1ad0a45e3e355e1123cae3f8b.tar.bz2 rails-78e7a0d3b7eaafe1ad0a45e3e355e1123cae3f8b.zip |
pull the preloader allocation in to a factory method
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 8575e5a7be..460daf99bc 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -639,7 +639,7 @@ module ActiveRecord preload = preload_values preload += includes_values unless eager_loading? - preloader = ActiveRecord::Associations::Preloader.new + preloader = build_preloader preload.each do |associations| preloader.preload @records, associations end @@ -650,6 +650,10 @@ module ActiveRecord @records end + def build_preloader + ActiveRecord::Associations::Preloader.new + end + def references_eager_loaded_tables? joined_tables = arel.join_sources.map do |join| if join.is_a?(Arel::Nodes::StringJoin) |