Flowdock
method

on

Importance_0
v3.0.0 - Show latest stable - 0 notes - Class: ActiveModel::DeprecatedErrorMethods
on(attribute) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide 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
Register or log in to add new notes.