From f3adddb966f3c93de4992b42cf554e3ef2a3acf1 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 15 Sep 2010 11:22:24 -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 | 3 +++ 1 file changed, 3 insertions(+) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/attribute_methods/dirty.rb b/activerecord/lib/active_record/attribute_methods/dirty.rb index 91d16ca97a..40ab37b5d2 100644 --- a/activerecord/lib/active_record/attribute_methods/dirty.rb +++ b/activerecord/lib/active_record/attribute_methods/dirty.rb @@ -33,6 +33,9 @@ module ActiveRecord @previously_changed = changes @changed_attributes.clear end + rescue + IdentityMap.remove(self) if IdentityMap.enabled? + raise end # reload the record and clears changed attributes. -- cgit v1.2.3