aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorJeremy Daer <jeremydaer@gmail.com>2016-02-01 14:26:12 -0700
committerJeremy Daer <jeremydaer@gmail.com>2016-02-01 14:26:12 -0700
commit633969f159c4f1ff23d98ec6e25cf84a78994824 (patch)
tree08209815635c56d0a393608284fcb0f50b718855 /activerecord/lib
parentb801566972d3e23d5f299e914034bda2d44ce5f5 (diff)
parent8fd123f7ebf938d21c1a097561950c6d7e1213bb (diff)
downloadrails-633969f159c4f1ff23d98ec6e25cf84a78994824.tar.gz
rails-633969f159c4f1ff23d98ec6e25cf84a78994824.tar.bz2
rails-633969f159c4f1ff23d98ec6e25cf84a78994824.zip
Merge pull request #23407 from jeremy/corrupt-before-commit
Fix corrupt transaction state caused by `before_commit` exceptions
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/transaction.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb
index 14d04a6388..6ecdab6eb0 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb
@@ -167,8 +167,13 @@ module ActiveRecord
def commit_transaction
transaction = @stack.last
- transaction.before_commit_records
- @stack.pop
+
+ begin
+ transaction.before_commit_records
+ ensure
+ @stack.pop
+ end
+
transaction.commit
transaction.commit_records
end