Class: ActiveRecord::ConnectionAdapters::SavepointTransaction
- Inherits:
-
OpenTransaction
- Object
- Transaction
- OpenTransaction
- ActiveRecord::ConnectionAdapters::SavepointTransaction
- Defined in:
- lib/active_record/connection_adapters/abstract/transaction.rb
Overview
:nodoc:
Instance Attribute Summary
Attributes inherited from OpenTransaction
Attributes inherited from Transaction
Instance Method Summary collapse
-
#initialize(connection, parent, options = {}) ⇒ SavepointTransaction
constructor
A new instance of SavepointTransaction.
- #perform_commit ⇒ Object
- #perform_rollback ⇒ Object
Methods inherited from OpenTransaction
#add_record, #begin, #closed?, #commit, #commit_records, #finishing?, #joinable?, #number, #open?, #rollback, #rollback_records
Methods inherited from Transaction
Constructor Details
#initialize(connection, parent, options = {}) ⇒ SavepointTransaction
Returns a new instance of SavepointTransaction.
186 187 188 189 190 191 192 193 |
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 186 def initialize(connection, parent, = {}) if [:isolation] raise ActiveRecord::TransactionIsolationError, "cannot set transaction isolation in a nested transaction" end super connection.create_savepoint end |
Instance Method Details
#perform_commit ⇒ Object
200 201 202 203 204 |
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 200 def perform_commit @state.set_state(:committed) @state.parent = parent.state connection.release_savepoint end |
#perform_rollback ⇒ Object
195 196 197 198 |
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 195 def perform_rollback connection.rollback_to_savepoint rollback_records end |