aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2010-09-13 14:56:14 -0300
committerEmilio Tagua <miloops@gmail.com>2010-11-19 19:04:58 -0300
commit09f12a12706593884961a682660f34282e937e46 (patch)
tree873b9d6be21a1548802919359baa9c3dcceba67b
parente88fd0230fd62ef0754c912e194ea0043ced310b (diff)
downloadrails-09f12a12706593884961a682660f34282e937e46.tar.gz
rails-09f12a12706593884961a682660f34282e937e46.tar.bz2
rails-09f12a12706593884961a682660f34282e937e46.zip
Use identity mapper only if enabled.
-rw-r--r--activerecord/lib/active_record/persistence.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb
index a7181fd79b..4fce0cbb3f 100644
--- a/activerecord/lib/active_record/persistence.rb
+++ b/activerecord/lib/active_record/persistence.rb
@@ -66,7 +66,7 @@ module ActiveRecord
def delete
if persisted?
self.class.delete(id)
- IdentityMap.remove(self)
+ IdentityMap.remove(self) if IdentityMap.enabled?
end
@destroyed = true
freeze
@@ -76,7 +76,7 @@ module ActiveRecord
# that no changes should be made (since they can't be persisted).
def destroy
if persisted?
- IdentityMap.remove(self)
+ IdentityMap.remove(self) if IdentityMap.enabled?
self.class.unscoped.where(self.class.arel_table[self.class.primary_key].eq(id)).delete_all
end
@@ -279,7 +279,7 @@ module ActiveRecord
self.id ||= new_id
- IdentityMap.add(self)
+ IdentityMap.add(self) if IdentityMap.enabled?
@persisted = true
id
end