1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

reuse the same preloader object for each association

This commit is contained in:
Aaron Patterson 2013-09-23 16:51:51 -07:00
parent 6e5a2cb951
commit f34d46ab82

View file

@ -599,9 +599,9 @@ module ActiveRecord
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