Class: ActiveRecord::ConnectionAdapters::RealTransaction

Inherits:
Transaction show all
Defined in:
activerecord/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, #closed?, #commit_records, #full_rollback?, #joinable?, #open?, #rollback_records

Constructor Details

#initialize(connection, options) ⇒ RealTransaction

Returns a new instance of RealTransaction.


135
136
137
138
139
140
141
142
# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 135

def initialize(connection, options)
  super
  if options[:isolation]
    connection.begin_isolated_db_transaction(options[:isolation])
  else
    connection.begin_db_transaction
  end
end

Instance Method Details

#commitObject


150
151
152
153
154
# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 150

def commit
  connection.commit_db_transaction
  super
  commit_records
end

#rollbackObject


144
145
146
147
148
# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 144

def rollback
  connection.rollback_db_transaction
  super
  rollback_records
end