diff options
author | Marcin Raczkowski <marcin.raczkowski@gmail.com> | 2010-09-06 03:30:06 +0200 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2010-11-19 19:04:40 -0300 |
commit | eebf33a2347bd4717b6ce966c2b7def4d573ec51 (patch) | |
tree | df3e9e61f1331b012d1a84eba434647e7630e28f /activerecord/lib/active_record | |
parent | ccb335da1f293dc745be0171ce3d95e50223d934 (diff) | |
download | rails-eebf33a2347bd4717b6ce966c2b7def4d573ec51.tar.gz rails-eebf33a2347bd4717b6ce966c2b7def4d573ec51.tar.bz2 rails-eebf33a2347bd4717b6ce966c2b7def4d573ec51.zip |
IdentityMap - Fixes problem with dirty attributes
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/base.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index d7e58ba978..c12633347e 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -899,8 +899,9 @@ module ActiveRecord #:nodoc: record_id = sti_class.primary_key && record[sti_class.primary_key] if ActiveRecord::IdentityMap.enabled? && record_id if object = identity_map.get(sti_class.name, record_id) - object.instance_variable_get("@attributes").update(record) object.instance_variable_get("@attributes_cache").replace({}) + object.instance_variable_get("@changed_attributes").update(record.slice(*object.changed)) + object.instance_variable_get("@attributes").update(record.except(*object.changed)) else object = instantiate_without_im(sti_class.allocate, record) identity_map.add(object) |