Class: ActiveRecord::ConnectionAdapters::RealTransaction
- Inherits:
-
Transaction
- Object
- Transaction
- ActiveRecord::ConnectionAdapters::RealTransaction
show all
- Defined in:
- lib/active_record/connection_adapters/abstract/transaction.rb
Overview
Active Record Real Transaction
Instance Attribute Summary
Attributes inherited from Transaction
#connection, #isolation_level, #savepoint_name, #state, #written
Instance Method Summary
collapse
Methods inherited from Transaction
#add_record, #before_commit_records, #closed?, #commit_records, #dirty!, #dirty?, #full_rollback?, #incomplete!, #initialize, #joinable?, #materialized?, #open?, #records, #restartable?, #restore!, #rollback_records
Instance Method Details
#commit ⇒ Object
399
400
401
402
403
|
# File '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
|
#materialize! ⇒ Object
369
370
371
372
373
374
375
376
377
|
# File '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
|
#restart ⇒ Object
379
380
381
382
383
384
385
386
387
388
389
390
391
|
# File '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
|
#rollback ⇒ Object
393
394
395
396
397
|
# File '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
|