123456789_123456789_123456789_123456789_123456789_

Class: ActiveRecord::ConnectionAdapters::SavepointTransaction

Relationships & Source Files
Inherits: ActiveRecord::ConnectionAdapters::Transaction
  • ::Object
Defined in: activerecord/lib/active_record/connection_adapters/abstract/transaction.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(connection, savepoint_name, options) ⇒ SavepointTransaction

[ GitHub ]

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

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

Instance Attribute Details

#full_rollback?Boolean (readonly)

[ GitHub ]

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

def full_rollback?; false; end

Instance Method Details

#commit

[ GitHub ]

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

def commit
  connection.release_savepoint(savepoint_name)
  super
  parent = connection.transaction_manager.current_transaction
  records.each { |r| parent.add_record(r) }
end

#rollback

[ GitHub ]

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

def rollback
  connection.rollback_to_savepoint(savepoint_name)
  super
  rollback_records
end