aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
authorArun Agrawal <arun@fromjaipur.com>2011-05-31 11:31:10 +0530
committerArun Agrawal <arun@fromjaipur.com>2011-05-31 11:31:10 +0530
commitcfb5f1b6083d4b0dabaaab70c383d223193811fd (patch)
treefb93415546070fd12c117e41907ca14c99c690cb /activerecord/lib/active_record/associations
parent7278547a5d1ac8a7c20d0edf62bc76c5434da6f5 (diff)
downloadrails-cfb5f1b6083d4b0dabaaab70c383d223193811fd.tar.gz
rails-cfb5f1b6083d4b0dabaaab70c383d223193811fd.tar.bz2
rails-cfb5f1b6083d4b0dabaaab70c383d223193811fd.zip
Fix nested attribute for memory record.
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/collection_association.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb
index 8a028c8996..17795f1b7d 100644
--- a/activerecord/lib/active_record/associations/collection_association.rb
+++ b/activerecord/lib/active_record/associations/collection_association.rb
@@ -402,7 +402,11 @@ module ActiveRecord
return memory if persisted.empty?
persisted.map! do |record|
- mem_record = memory.delete(record)
+ mem_record_index = memory.index(record)
+ if mem_record_index
+ mem_record = memory.at(mem_record_index)
+ memory.delete_at(mem_record_index)
+ end
if mem_record
(record.attribute_names - mem_record.changes.keys).each do |name|