instance method match?

Ruby on Rails 7.0.10

Since v6.1.7.10

Available in: v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

match?(attribute, type = nil, **options)

See if error matches provided attribute, type, and options.

Omitted params are not checked for a match.

Parameters

attribute req
type opt = nil
options keyrest
Source
# File activemodel/lib/active_model/error.rb, line 165
    def match?(attribute, type = nil, **options)
      if @attribute != attribute || (type && @type != type)
        return false
      end

      options.each do |key, value|
        if @options[key] != value
          return false
        end
      end

      true
    end

Defined in activemodel/lib/active_model/error.rb line 165 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveModel::Error

Type at least 2 characters to search.

↑↓ navigate · open · esc close