Class: ActiveRecord::ConnectionAdapters::RealTransaction
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Transaction
|
|
Instance Chain:
self,
Transaction
|
|
Inherits: |
ActiveRecord::ConnectionAdapters::Transaction
|
Defined in: | activerecord/lib/active_record/connection_adapters/abstract/transaction.rb |
Overview
Active Record Real Transaction
Class Method Summary
Transaction
- Inherited
Instance Attribute Summary
Transaction
- Inherited
#closed?, #connection, #dirty?, #full_rollback?, #isolation_level, #joinable?, #materialized?, #open?, | |
#restartable? | Can this transaction’s current state be recreated by rollback+begin ? |
#savepoint_name, #state, #user_transaction, #written |
Instance Method Summary
Transaction
- Inherited
Constructor Details
This class inherits a constructor from ActiveRecord::ConnectionAdapters::Transaction
Instance Method Details
#commit
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 487
def commit if materialized? connection.commit_db_transaction connection.reset_isolation_level if isolation_level end @state.full_commit! @instrumenter.finish(:commit) if materialized? end
#materialize!
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 450
def materialize! if joinable? if isolation_level connection.begin_isolated_db_transaction(isolation_level) else connection.begin_db_transaction end else connection.begin_deferred_transaction(isolation_level) end super end
#restart
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 464
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
#rollback
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 478
def rollback if materialized? connection.rollback_db_transaction connection.reset_isolation_level if isolation_level end @state.full_rollback! @instrumenter.finish(:rollback) if materialized? end