edge badge
Methods
A
C
F
N
R
S
Class Public methods
new(state = nil)
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 5
def initialize(state = nil)
  @state = state
  @children = []
end
Instance Public methods
add_child(state)
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 10
def add_child(state)
  @children << state
end
commit!()
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 57
def commit!
  @state = :committed
end
committed?()
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 18
def committed?
  @state == :committed
end
completed?()
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 30
def completed?
  committed? || rolledback?
end
finalized?()
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 14
def finalized?
  @state
end
fully_completed?()
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 26
def fully_completed?
  completed?
end
nullify!()
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 61
def nullify!
  @state = nil
end
rollback!()
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 52
def rollback!
  @children.each { |c| c.rollback! }
  @state = :rolledback
end
rolledback?()
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 22
def rolledback?
  @state == :rolledback
end
set_state(state)
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 34
      def set_state(state)
        ActiveSupport::Deprecation.warn("          The set_state method is deprecated and will be removed in
          Rails 6.0. Please use rollback! or commit! to set transaction
          state directly.
".squish)
        case state
        when :rolledback
          rollback!
        when :committed
          commit!
        when nil
          nullify!
        else
          raise ArgumentError, "Invalid transaction state: #{state}"
        end
      end