diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2012-01-05 19:59:09 -0200 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2012-01-05 19:59:24 -0200 |
commit | be52f1bf2a5e250f0e2182f2b756ac68c81718f3 (patch) | |
tree | ab17abde97be98d5d6c63ab9c00a6bd16ff0a64c | |
parent | 5e1cfb04a915e1f033c108c8c147981fae7b7925 (diff) | |
download | rails-be52f1bf2a5e250f0e2182f2b756ac68c81718f3.tar.gz rails-be52f1bf2a5e250f0e2182f2b756ac68c81718f3.tar.bz2 rails-be52f1bf2a5e250f0e2182f2b756ac68c81718f3.zip |
Use 1.9 way
-rw-r--r-- | activerecord/lib/active_record/associations/collection_association.rb | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index fe9f30bd2a..68538afbc9 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -400,12 +400,7 @@ module ActiveRecord return memory if persisted.empty? persisted.map! do |record| - # Unfortunately we cannot simply do memory.delete(record) since on 1.8 this returns - # record rather than memory.at(memory.index(record)). The behavior is fixed in 1.9. - mem_index = memory.index(record) - - if mem_index - mem_record = memory.delete_at(mem_index) + if mem_record = memory.delete(record) (record.attribute_names - mem_record.changes.keys).each do |name| mem_record[name] = record[name] |