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, #isolation_level, #records, #savepoint_name, #state

Instance Method Summary collapse

Methods inherited from Transaction

#add_record, #before_commit_records, #closed?, #commit_records, #full_rollback?, #initialize, #joinable?, #materialized?, #open?, #rollback_records

Constructor Details

This class inherits a constructor from ActiveRecord::ConnectionAdapters::Transaction

Instance Method Details

#commitObject



194
195
196
197
# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 194

def commit
  connection.commit_db_transaction if materialized?
  @state.full_commit!
end

#materialize!Object



179
180
181
182
183
184
185
186
187
# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 179

def materialize!
  if isolation_level
    connection.begin_isolated_db_transaction(isolation_level)
  else
    connection.begin_db_transaction
  end

  super
end

#rollbackObject



189
190
191
192
# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 189

def rollback
  connection.rollback_db_transaction if materialized?
  @state.full_rollback!
end