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.



125
126
127
128
129
130
131
132
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 125

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



139
140
141
142
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 139

def commit
  connection.commit_db_transaction
  super
end

#rollbackObject



134
135
136
137
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 134

def rollback
  connection.rollback_db_transaction
  super
end