From eebf33a2347bd4717b6ce966c2b7def4d573ec51 Mon Sep 17 00:00:00 2001 From: Marcin Raczkowski Date: Mon, 6 Sep 2010 03:30:06 +0200 Subject: IdentityMap - Fixes problem with dirty attributes --- activerecord/lib/active_record/base.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activerecord/lib') 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) -- cgit v1.2.3