diff options
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/associations/collection_association.rb | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index 50825a50f0..525ac65722 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -405,14 +405,8 @@ module ActiveRecord mem_record = memory.delete(record) if mem_record - # Only try to assign attributes which exist on mem_record - shared = mem_record.attribute_names & record.attribute_names - - # Don't try to assign the primary key, or attributes which have changed on mem_record - excluded = ["id"] + mem_record.changes.keys - - (shared - excluded).each do |key| - mem_record[key] = record[key] + (record.attribute_names - mem_record.changes.keys).each do |name| + mem_record[name] = record[name] end mem_record |