aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorPiotr Sarnacki <drogus@gmail.com>2012-05-18 12:47:55 -0700
committerPiotr Sarnacki <drogus@gmail.com>2012-05-19 05:20:25 -0700
commitd64164645d435e22fdab8179481acb89827dfe68 (patch)
tree7c39acfc9224ce1bd937a6b7069eeff3445b72a0 /activerecord/lib/active_record
parent4dd4621f5bb5500092e635e80e1b1cb1d888b6ec (diff)
downloadrails-d64164645d435e22fdab8179481acb89827dfe68.tar.gz
rails-d64164645d435e22fdab8179481acb89827dfe68.tar.bz2
rails-d64164645d435e22fdab8179481acb89827dfe68.zip
Ensure that CollectionAssociation#replace returns proper target
The fix commited in e2a070c was returning the `new_target`, as a try to return whatever user replaced association with. The problem is, the resulting association target may be ordered differently. In such case we want to return the target that will be later used for that association.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/associations/collection_association.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb
index 0dace89dac..4c58094cfd 100644
--- a/activerecord/lib/active_record/associations/collection_association.rb
+++ b/activerecord/lib/active_record/associations/collection_association.rb
@@ -492,7 +492,7 @@ module ActiveRecord
"new records could not be saved."
end
- new_target
+ target
end
def concat_records(records)