method
on
rails latest stable - Class:
ActiveModel::DeprecatedErrorMethods
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