Methods

Class Public methods

new(state = nil)

📝 Source code
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 6
      def initialize(state = nil)
        @state = state
        @children = []
      end
🔎 See on GitHub

Instance Public methods

add_child(state)

📝 Source code
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 11
      def add_child(state)
        @children << state
      end
🔎 See on GitHub

commit!()

📝 Source code
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 71
      def commit!
        @state = :committed
      end
🔎 See on GitHub

committed?()

📝 Source code
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 19
      def committed?
        @state == :committed || @state == :fully_committed
      end
🔎 See on GitHub

completed?()

📝 Source code
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 39
      def completed?
        committed? || rolledback?
      end
🔎 See on GitHub

finalized?()

📝 Source code
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 15
      def finalized?
        @state
      end
🔎 See on GitHub

full_commit!()

📝 Source code
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 75
      def full_commit!
        @state = :fully_committed
      end
🔎 See on GitHub

full_rollback!()

📝 Source code
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 66
      def full_rollback!
        @children.each { |c| c.rollback! }
        @state = :fully_rolledback
      end
🔎 See on GitHub

fully_committed?()

📝 Source code
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 23
      def fully_committed?
        @state == :fully_committed
      end
🔎 See on GitHub

fully_completed?()

📝 Source code
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 35
      def fully_completed?
        completed?
      end
🔎 See on GitHub

fully_rolledback?()

📝 Source code
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 31
      def fully_rolledback?
        @state == :fully_rolledback
      end
🔎 See on GitHub

nullify!()

📝 Source code
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 79
      def nullify!
        @state = nil
      end
🔎 See on GitHub

rollback!()

📝 Source code
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 61
      def rollback!
        @children.each { |c| c.rollback! }
        @state = :rolledback
      end
🔎 See on GitHub

rolledback?()

📝 Source code
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 27
      def rolledback?
        @state == :rolledback || @state == :fully_rolledback
      end
🔎 See on GitHub

set_state(state)

📝 Source code
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 43
      def set_state(state)
        ActiveSupport::Deprecation.warn(<<-MSG.squish)
          The set_state method is deprecated and will be removed in
          Rails 6.0. Please use rollback! or commit! to set transaction
          state directly.
        MSG
        case state
        when :rolledback
          rollback!
        when :committed
          commit!
        when nil
          nullify!
        else
          raise ArgumentError, "Invalid transaction state: #{state}"
        end
      end
🔎 See on GitHub