diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2013-07-14 20:06:01 -0700 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2013-07-14 20:06:01 -0700 |
commit | 8833b82df0df699aa0cc97ca1212174f5902697f (patch) | |
tree | 34f72c17ddb7a43791bdfeb0709ac59ec4255193 /activerecord/lib/active_record/transactions.rb | |
parent | 5979bc9e11d68e11458a27037edffaa368990f27 (diff) | |
parent | e0d59e6219c752d8cffc6b78c2240755f5728922 (diff) | |
download | rails-8833b82df0df699aa0cc97ca1212174f5902697f.tar.gz rails-8833b82df0df699aa0cc97ca1212174f5902697f.tar.bz2 rails-8833b82df0df699aa0cc97ca1212174f5902697f.zip |
Merge pull request #11434 from jetthoughts/new_save_transaction_bugfix
Remove extra decrement of transaction level
Diffstat (limited to 'activerecord/lib/active_record/transactions.rb')
-rw-r--r-- | activerecord/lib/active_record/transactions.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/transactions.rb b/activerecord/lib/active_record/transactions.rb index 62920d936f..dcbf38a89f 100644 --- a/activerecord/lib/active_record/transactions.rb +++ b/activerecord/lib/active_record/transactions.rb @@ -304,6 +304,7 @@ module ActiveRecord run_callbacks :rollback ensure restore_transaction_record_state(force_restore_state) + clear_transaction_record_state end # Add the record to the current transaction so that the +after_rollback+ and +after_commit+ callbacks @@ -360,8 +361,8 @@ module ActiveRecord # Restore the new record state and id of a record that was previously saved by a call to save_record_state. def restore_transaction_record_state(force = false) #:nodoc: unless @_start_transaction_state.empty? - @_start_transaction_state[:level] = (@_start_transaction_state[:level] || 0) - 1 - if @_start_transaction_state[:level] < 1 || force + transaction_level = (@_start_transaction_state[:level] || 0) - 1 + if transaction_level < 1 || force restore_state = @_start_transaction_state was_frozen = restore_state[:frozen?] @attributes = @attributes.dup if @attributes.frozen? @@ -374,7 +375,6 @@ module ActiveRecord @attributes_cache.delete(self.class.primary_key) end @attributes.freeze if was_frozen - @_start_transaction_state.clear end end end |