Use identity mapper only if enabled.
This commit is contained in:
parent
e88fd0230f
commit
09f12a1270
|
@ -66,7 +66,7 @@ module ActiveRecord
|
||||||
def delete
|
def delete
|
||||||
if persisted?
|
if persisted?
|
||||||
self.class.delete(id)
|
self.class.delete(id)
|
||||||
IdentityMap.remove(self)
|
IdentityMap.remove(self) if IdentityMap.enabled?
|
||||||
end
|
end
|
||||||
@destroyed = true
|
@destroyed = true
|
||||||
freeze
|
freeze
|
||||||
|
@ -76,7 +76,7 @@ module ActiveRecord
|
||||||
# that no changes should be made (since they can't be persisted).
|
# that no changes should be made (since they can't be persisted).
|
||||||
def destroy
|
def destroy
|
||||||
if persisted?
|
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
|
self.class.unscoped.where(self.class.arel_table[self.class.primary_key].eq(id)).delete_all
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ module ActiveRecord
|
||||||
|
|
||||||
self.id ||= new_id
|
self.id ||= new_id
|
||||||
|
|
||||||
IdentityMap.add(self)
|
IdentityMap.add(self) if IdentityMap.enabled?
|
||||||
@persisted = true
|
@persisted = true
|
||||||
id
|
id
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue