diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-12-26 13:11:18 -0700 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-12-26 13:13:27 -0700 |
commit | f5e6bafe6a7832ff20ebc3397e3b212ded2e6f63 (patch) | |
tree | 160c7207257aeb6fd18621551018001bbfdcab08 /activerecord/lib | |
parent | a983e1e89c6f55cd08feb394db33ca0620fadfd1 (diff) | |
parent | c6fd24643604b5779a76527e6364f21ee5cc3ce0 (diff) | |
download | rails-f5e6bafe6a7832ff20ebc3397e3b212ded2e6f63.tar.gz rails-f5e6bafe6a7832ff20ebc3397e3b212ded2e6f63.tar.bz2 rails-f5e6bafe6a7832ff20ebc3397e3b212ded2e6f63.zip |
Merge branch 'brainopia-remember_frozen_state_in_transaction'
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/transactions.rb | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/transactions.rb b/activerecord/lib/active_record/transactions.rb index c4a97db582..de701edca0 100644 --- a/activerecord/lib/active_record/transactions.rb +++ b/activerecord/lib/active_record/transactions.rb @@ -360,14 +360,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 - 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.reverse_merge!( + new_record: @new_record, + destroyed: @destroyed, + frozen?: frozen?, + ) @_start_transaction_state[:level] = (@_start_transaction_state[:level] || 0) + 1 - @_start_transaction_state[:frozen?] = frozen? end # Clear the new record state and id of a record. |