instance method on

Ruby on Rails 3.0.20

Since v2.2.3 Last seen in v3.0.20

Available in: v2.2.3 v2.3.18 v3.0.20

Signature

on(attribute)

No documentation comment.

Parameters

attribute req
Source
# File activemodel/lib/active_model/deprecated_error_methods.rb, line 3
    def on(attribute)
      message = "Errors#on have been deprecated, use Errors#[] instead.\n"
      message << "Also note that the behaviour of Errors#[] has changed. Errors#[] now always returns an Array. An empty Array is "
      message << "returned when there are no errors on the specified attribute."
      ActiveSupport::Deprecation.warn(message)

      errors = self[attribute]
      errors.size < 2 ? errors.first : errors
    end

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

Defined in ActiveModel::DeprecatedErrorMethods

Type at least 2 characters to search.

↑↓ navigate · open · esc close