# File lib/active_record/vendor/simple.rb, line 426
    def abort_transaction(name = nil)
      if @__transaction_checkpoint__.nil?
        raise TransactionError, Messages[:cannot_abort_no_transaction]
      end

        # Check to see if we are trying to abort a transaction that is
        # outside of the current transaction block. Otherwise, raise
        # TransactionAborted if they are the same.
      if @__transaction_block__ and name
        nix = @__transaction_names__.index(name) + 1
        if nix < @__transaction_block__
          raise TransactionError, Messages[:cannot_abort_transaction_before_block]
        end

        raise TransactionAborted if @__transaction_block__ == nix
      end

      raise TransactionAborted if @__transaction_block__ == @__transaction_level__

      if name.nil?
        __abort_transaction(name)
      else
        unless @__transaction_names__.include?(name)
          raise TransactionError, Messages[:cannot_abort_named_transaction] % name.inspect
        end
        __abort_transaction(name) while @__transaction_names__.include?(name)
      end
      self
    end