Class: ActiveRecord::ConnectionAdapters::RestartParentTransaction
- Inherits:
-
Transaction
- Object
- Transaction
- ActiveRecord::ConnectionAdapters::RestartParentTransaction
- Defined in:
- lib/active_record/connection_adapters/abstract/transaction.rb
Overview
Active Record Restart Parent Transaction
Instance Attribute Summary
Attributes inherited from Transaction
#connection, #isolation_level, #savepoint_name, #state, #written
Instance Method Summary collapse
- #commit ⇒ Object
- #full_rollback? ⇒ Boolean
-
#initialize(connection, parent_transaction, **options) ⇒ RestartParentTransaction
constructor
A new instance of RestartParentTransaction.
- #rollback ⇒ Object
Methods inherited from Transaction
#add_record, #before_commit_records, #closed?, #commit_records, #dirty!, #dirty?, #incomplete!, #joinable?, #materialize!, #materialized?, #open?, #records, #restartable?, #restore!, #rollback_records
Constructor Details
#initialize(connection, parent_transaction, **options) ⇒ RestartParentTransaction
Returns a new instance of RestartParentTransaction.
296 297 298 299 300 301 302 303 304 305 306 |
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 296 def initialize(connection, parent_transaction, **) super(connection, **) @parent = parent_transaction if isolation_level raise ActiveRecord::TransactionIsolationError, "cannot set transaction isolation in a nested transaction" end @parent.state.add_child(@state) end |
Instance Method Details
#commit ⇒ Object
315 316 317 |
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 315 def commit @state.commit! end |
#full_rollback? ⇒ Boolean
319 |
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 319 def full_rollback?; false; end |
#rollback ⇒ Object
310 311 312 313 |
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 310 def rollback @state.rollback! @parent.restart end |