Active Record Real Transaction
Methods
Instance Public methods
commit()
📝 Source code
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 399
def commit
connection.commit_db_transaction if materialized?
@state.full_commit!
@instrumenter.finish(:commit) if materialized?
end
🔎 See on GitHub
materialize!()
📝 Source code
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 369
def materialize!
if isolation_level
connection.begin_isolated_db_transaction(isolation_level)
else
connection.begin_db_transaction
end
super
end
🔎 See on GitHub
restart()
📝 Source code
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 379
def restart
return unless materialized?
@instrumenter.finish(:restart)
if connection.supports_restart_db_transaction?
@instrumenter.start
connection.restart_db_transaction
else
connection.rollback_db_transaction
materialize!
end
end
🔎 See on GitHub
rollback()
📝 Source code
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 393
def rollback
connection.rollback_db_transaction if materialized?
@state.full_rollback!
@instrumenter.finish(:rollback) if materialized?
end
🔎 See on GitHub