Class: ActiveRecord::ConnectionAdapters::RealTransaction

Inherits:
Transaction
  • Object
show all
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

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, options, *args)
  super
  if options[:isolation]
    connection.begin_isolated_db_transaction(options[:isolation])
  else
    connection.begin_db_transaction
  end
end

Instance Method Details

#commitObject



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

#rollbackObject



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