From e83f5a0ae97889dddfd0956081b0f4582594cda9 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 15 Sep 2010 11:18:34 -0300 Subject: Remove objects from identity map if save failed, otherwise finding again the same record will have invalid attributes. --- activerecord/lib/active_record/attribute_methods/dirty.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'activerecord/lib/active_record/attribute_methods') diff --git a/activerecord/lib/active_record/attribute_methods/dirty.rb b/activerecord/lib/active_record/attribute_methods/dirty.rb index 439880c1fa..91d16ca97a 100644 --- a/activerecord/lib/active_record/attribute_methods/dirty.rb +++ b/activerecord/lib/active_record/attribute_methods/dirty.rb @@ -21,6 +21,8 @@ module ActiveRecord if status = super @previously_changed = changes @changed_attributes.clear + elsif IdentityMap.enabled? + IdentityMap.remove(self) end status end -- cgit v1.2.3