aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/identity_map.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/identity_map.rb b/activerecord/lib/active_record/identity_map.rb
index c9edd441a4..b0ff88d8bf 100644
--- a/activerecord/lib/active_record/identity_map.rb
+++ b/activerecord/lib/active_record/identity_map.rb
@@ -56,9 +56,11 @@ module ActiveRecord
# +coder+ must contain the attributes necessary for initializing an empty
# model object.
def reinit_with(coder)
- @previously_changed = changes
- @attributes_cache, @changed_attributes = {}, {}
- @attributes.update(coder['attributes'])
+ @attributes_cache = {}
+ dirty = @changed_attributes.keys
+ @attributes.update(coder['attributes'].except(*dirty))
+ @changed_attributes.update(coder['attributes'].slice(*dirty))
+ @changed_attributes.delete_if{|k,v| v.eql? @attributes[k]}
_run_find_callbacks