Class: ActiveRecord::ConnectionAdapters::RealTransaction
- Inherits:
-
Transaction
- Object
- Transaction
- ActiveRecord::ConnectionAdapters::RealTransaction
- Defined in:
- lib/active_record/connection_adapters/abstract/transaction.rb
Instance Attribute Summary
Attributes inherited from Transaction
#connection, #joinable, #records, #savepoint_name, #state
Instance Method Summary collapse
- #commit ⇒ Object
-
#initialize(connection, options, *args) ⇒ RealTransaction
constructor
A new instance of RealTransaction.
- #rollback ⇒ Object
Methods inherited from Transaction
#add_record, #before_commit_records, #closed?, #commit_records, #full_rollback?, #joinable?, #open?, #rollback_records
Constructor Details
#initialize(connection, options, *args) ⇒ RealTransaction
Returns a new instance of RealTransaction.
170 171 172 173 174 175 176 177 |
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 170 def initialize(connection, , *args) super if [:isolation] connection.begin_isolated_db_transaction([:isolation]) else connection.begin_db_transaction end end |
Instance Method Details
#commit ⇒ Object
184 185 186 187 |
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 184 def commit connection.commit_db_transaction @state.full_commit! end |
#rollback ⇒ Object
179 180 181 182 |
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 179 def rollback connection.rollback_db_transaction @state.full_rollback! end |