Permalink
Browse files

reuse the same preloader object for each association

  • Loading branch information...
1 parent 6e5a2cb commit f34d46ab824e3db121d0e02c7859b6aceb8093d9 @tenderlove tenderlove committed Sep 23, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 activerecord/lib/active_record/relation.rb
View
4 activerecord/lib/active_record/relation.rb
@@ -599,9 +599,9 @@ def exec_queries
preload = preload_values
preload += includes_values unless eager_loading?
+ preloader = ActiveRecord::Associations::Preloader.new
preload.each do |associations|
- pl = ActiveRecord::Associations::Preloader.new
- pl.preload @records, associations
+ preloader.preload @records, associations
end
@records.each { |record| record.readonly! } if readonly_value

0 comments on commit f34d46a

Please sign in to comment.