diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-18 16:33:18 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-18 16:33:18 -0800 |
commit | a282301a77288252d135855d088f20de2397998e (patch) | |
tree | 28991c729f85ee2454015e88a1461a5aa8655301 /activerecord | |
parent | c107849a997f1014d2e28ce394c3d9ccb3a1f50c (diff) | |
download | rails-a282301a77288252d135855d088f20de2397998e.tar.gz rails-a282301a77288252d135855d088f20de2397998e.tar.bz2 rails-a282301a77288252d135855d088f20de2397998e.zip |
we have a method for setting preloaded records, so use it
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/association_preload.rb | 8 |
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]) |