aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-04-10 15:18:30 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-04-10 15:21:07 -0300
commit9d2146ac6e4c1fdc9cc157d614b1eb9968ac6a2e (patch)
tree79a4e6576409a5d65662b761ca73ba1792c0ea72 /activerecord/lib
parent8c883855b40d4ecfb52329ab2de72755be6ad1ba (diff)
downloadrails-9d2146ac6e4c1fdc9cc157d614b1eb9968ac6a2e.tar.gz
rails-9d2146ac6e4c1fdc9cc157d614b1eb9968ac6a2e.tar.bz2
rails-9d2146ac6e4c1fdc9cc157d614b1eb9968ac6a2e.zip
Revert "Merge pull request #6226 from gnufied/master"
This reverts commit 9bf1a0db4acbbf9e8e6f707250269185224e7efe, reversing changes made to fed97091b9546d369a240d10b184793d49247dd3. Conflicts: activerecord/test/cases/transaction_callbacks_test.rb Reason: This fix introduces another issue described at #8937, so we are reverting it to restore the behavior of 3-2-stable. We will fix both issues when we come out with a better solution
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/transactions.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/transactions.rb b/activerecord/lib/active_record/transactions.rb
index 4dbd668fcf..a5955ccba4 100644
--- a/activerecord/lib/active_record/transactions.rb
+++ b/activerecord/lib/active_record/transactions.rb
@@ -339,8 +339,12 @@ module ActiveRecord
# Save the new record state and id of a record so it can be restored later if a transaction fails.
def remember_transaction_record_state #:nodoc:
@_start_transaction_state[:id] = id if has_attribute?(self.class.primary_key)
- @_start_transaction_state[:new_record] = @new_record
- @_start_transaction_state[:destroyed] = @destroyed
+ unless @_start_transaction_state.include?(:new_record)
+ @_start_transaction_state[:new_record] = @new_record
+ end
+ unless @_start_transaction_state.include?(:destroyed)
+ @_start_transaction_state[:destroyed] = @destroyed
+ end
@_start_transaction_state[:level] = (@_start_transaction_state[:level] || 0) + 1
@_start_transaction_state[:frozen?] = @attributes.frozen?
end