diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-05-31 08:46:27 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-05-31 08:46:27 -0700 |
commit | 021e4f16b7db21d397196d9e1c1a693935e1e371 (patch) | |
tree | 0581aef18ecaa32f19736bf7aac2997aa2d3316c /activerecord/lib/active_record/associations/collection_association.rb | |
parent | 12786518f1f712e32d850c09de22635823533500 (diff) | |
parent | e04f2c1d42bdc11f47a0f8c82fa1766ad89b7719 (diff) | |
download | rails-021e4f16b7db21d397196d9e1c1a693935e1e371.tar.gz rails-021e4f16b7db21d397196d9e1c1a693935e1e371.tar.bz2 rails-021e4f16b7db21d397196d9e1c1a693935e1e371.zip |
Merge pull request #1417 from arunagw/nested_attributes_fix
Fix nested attribute for memory record.
Diffstat (limited to 'activerecord/lib/active_record/associations/collection_association.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/collection_association.rb | 9 |
1 files changed, 8 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..c32dd77420 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -402,7 +402,14 @@ module ActiveRecord return memory if persisted.empty? persisted.map! do |record| - mem_record = memory.delete(record) + + # To work with ruby 1.8.7 + # > 1.9 #=> 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| |