From 099bb5d7b0e139d097b0c9bab4cdc8a36cf05ffa Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Fri, 18 May 2012 12:47:55 -0700 Subject: 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. --- activerecord/lib/active_record/associations/collection_association.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/associations') diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index c6c7cdc188..8dbcf8b225 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -476,7 +476,7 @@ module ActiveRecord "new records could not be saved." end - new_target + target end def concat_records(records) -- cgit v1.2.3