Method: Validatable::Errors#on
- Defined in:
- lib/errors.rb
#on(attribute) ⇒ Object
call-seq: on(attribute)
-
Returns nil, if no errors are associated with the specified
attribute
. -
Returns the error message, if one error is associated with the specified
attribute
. -
Returns an array of error messages, if more than one error is associated with the specified
attribute
.
13 14 15 16 |
# File 'lib/errors.rb', line 13 def on(attribute) return nil if errors[attribute.to_sym].nil? errors[attribute.to_sym].size == 1 ? errors[attribute.to_sym].first : errors[attribute.to_sym] end |