method

on

rails latest stable - Class: ActiveModel::DeprecatedErrorMethods

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v3.0.9) is shown here.

on(attribute)
public

No documentation available.

# 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