From 67d8bb963d5d51fc644d6b1ca20164efb4cee6d7 Mon Sep 17 00:00:00 2001 From: wangjohn Date: Thu, 24 Jan 2013 23:42:39 -0500 Subject: Reduced memory leak problem in transactions by lazily updating AR objects with new transaction state. If AR object has a callback, the callback will be performed immediately (non-lazily) so the transaction still has to keep records with callbacks. --- activerecord/lib/active_record/persistence.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'activerecord/lib/active_record/persistence.rb') diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index 803cae7115..066f93635a 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -69,11 +69,13 @@ module ActiveRecord # Returns true if this object hasn't been saved yet -- that is, a record # for the object doesn't exist in the data store yet; otherwise, returns false. def new_record? + sync_with_transaction_state @new_record end # Returns true if this object has been destroyed, otherwise returns false. def destroyed? + sync_with_transaction_state @destroyed end -- cgit v1.2.3