123456789_123456789_123456789_123456789_123456789_

Class: ActiveRecord::ConnectionAdapters::RestartParentTransaction

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

Overview

Active Record Restart Parent Transaction

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(connection, parent_transaction, **options) ⇒ RestartParentTransaction

[ GitHub ]

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

def initialize(connection, parent_transaction, **options)
  super(connection, **options)

  @parent = parent_transaction

  if isolation_level
    raise ActiveRecord::TransactionIsolationError, "cannot set transaction isolation in a nested transaction"
  end

  @parent.state.add_child(@state)
end

Instance Attribute Details

#full_rollback?Boolean (readonly)

[ GitHub ]

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

def full_rollback?; false; end

#restart (readonly)

[ GitHub ]

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

delegate :materialize!, :materialized?, :restart, to: :@parent

Instance Method Details

#commit

[ GitHub ]

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

def commit
  @state.commit!
end

#materialize!

[ GitHub ]

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

delegate :materialize!, :materialized?, :restart, to: :@parent

#materialized?Boolean

[ GitHub ]

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

delegate :materialize!, :materialized?, :restart, to: :@parent

#rollback

[ GitHub ]

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

def rollback
  @state.rollback!
  @parent.restart
end