aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
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 04:06:11 -0700
commit099bb5d7b0e139d097b0c9bab4cdc8a36cf05ffa (patch)
tree6a57a0a51ed7b7a04c576320b0c0e21b1e8a603a /activerecord/lib/active_record/associations
parentec774983514d4ce1b593585ae14a17b730ee2c46 (diff)
downloadrails-099bb5d7b0e139d097b0c9bab4cdc8a36cf05ffa.tar.gz
rails-099bb5d7b0e139d097b0c9bab4cdc8a36cf05ffa.tar.bz2
rails-099bb5d7b0e139d097b0c9bab4cdc8a36cf05ffa.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/associations')
-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 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)