From cfb5f1b6083d4b0dabaaab70c383d223193811fd Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Tue, 31 May 2011 11:31:10 +0530 Subject: Fix nested attribute for memory record. --- .../lib/active_record/associations/collection_association.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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| -- cgit v1.2.3