aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-01-18 16:33:18 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-01-18 16:33:18 -0800
commita282301a77288252d135855d088f20de2397998e (patch)
tree28991c729f85ee2454015e88a1461a5aa8655301
parentc107849a997f1014d2e28ce394c3d9ccb3a1f50c (diff)
downloadrails-a282301a77288252d135855d088f20de2397998e.tar.gz
rails-a282301a77288252d135855d088f20de2397998e.tar.bz2
rails-a282301a77288252d135855d088f20de2397998e.zip
we have a method for setting preloaded records, so use it
-rw-r--r--activerecord/lib/active_record/association_preload.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/association_preload.rb b/activerecord/lib/active_record/association_preload.rb
index 8e71c6eec5..cba4bab3ef 100644
--- a/activerecord/lib/active_record/association_preload.rb
+++ b/activerecord/lib/active_record/association_preload.rb
@@ -166,9 +166,7 @@ module ActiveRecord
id_to_record_map.each do |id, records|
next if seen_keys.include?(id)
- records.each do |record|
- record.send(:association_proxy, reflection_name).target = nil
- end
+ add_preloaded_record_to_collection(records, reflection_name, nil)
end
end
@@ -239,9 +237,7 @@ module ActiveRecord
id_to_record_map = construct_id_map(records, reflection.options[:primary_key])
options = reflection.options
- records.each do |record|
- record.send(:association_proxy, reflection.name).target = nil
- end
+ add_preloaded_record_to_collection(records, reflection.name, nil)
if options[:through]
through_records = preload_through_records(records, reflection, options[:through])