diff --git a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb index f7ca6157af7..eb473142aaf 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb @@ -533,8 +533,7 @@ module ActiveRecord @connection.lock.synchronize do transaction = begin_transaction(isolation: isolation, joinable: joinable) begin - ret = yield - ret + yield rescue Exception => error rollback_transaction after_failure_actions(transaction, error)