Class: ActiveRecord::ConnectionAdapters::SavepointTransaction
- Inherits:
-
OpenTransaction
- Object
- Transaction
- OpenTransaction
- ActiveRecord::ConnectionAdapters::SavepointTransaction
- Defined in:
- activerecord/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.
182 183 184 185 186 187 188 189 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 182 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
196 197 198 199 200 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 196 def perform_commit @state.set_state(:committed) @state.parent = parent.state connection.release_savepoint end |
#perform_rollback ⇒ Object
191 192 193 194 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 191 def perform_rollback connection.rollback_to_savepoint rollback_records end |