method
reset_transaction
v7.2.3 -
Show latest stable
- Class:
ActiveRecord::ConnectionAdapters::DatabaseStatements
reset_transaction(restore: false)public
No documentation available.
# File activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb, line 385
def reset_transaction(restore: false) # :nodoc:
# Store the existing transaction state to the side
old_state = @transaction_manager if restore && @transaction_manager&.restorable?
@transaction_manager = ConnectionAdapters::TransactionManager.new(self)
if block_given?
# Reconfigure the connection without any transaction state in the way
result = yield
# Now the connection's fully established, we can swap back
if old_state
@transaction_manager = old_state
@transaction_manager.restore_transactions
end
result
end
end