Class: ActiveRecord::ConnectionAdapters::SavepointTransaction

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, #before_commit_records, #closed?, #commit_records, #joinable?, #open?, #rollback_records

Constructor Details

#initialize(connection, savepoint_name, options, *args) ⇒ SavepointTransaction


105
106
107
108
109
110
111
# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 105

def initialize(connection, savepoint_name, options, *args)
  super(connection, options, *args)
  if options[:isolation]
    raise ActiveRecord::TransactionIsolationError, "cannot set transaction isolation in a nested transaction"
  end
  connection.create_savepoint(@savepoint_name = savepoint_name)
end

Instance Method Details

#commitObject


118
119
120
121
# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 118

def commit
  connection.release_savepoint(savepoint_name)
  super
end

#full_rollback?Boolean


123
# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 123

def full_rollback?; false; end

#rollbackObject


113
114
115
116
# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 113

def rollback
  connection.rollback_to_savepoint(savepoint_name)
  super
end