Class: Validatable::Errors
- Inherits:
-
Object
- Object
- Validatable::Errors
- Extended by:
- Forwardable
- Defined in:
- lib/errors.rb
Instance Method Summary collapse
-
#add(attribute, message) ⇒ Object
:nodoc:.
-
#errors ⇒ Object
:nodoc:.
-
#on(attribute) ⇒ Object
call-seq: on(attribute).
Instance Method Details
#add(attribute, message) ⇒ Object
:nodoc:
15 16 17 |
# File 'lib/errors.rb', line 15 def add(attribute, ) #:nodoc: errors[attribute.to_sym] = end |
#errors ⇒ Object
:nodoc:
19 20 21 |
# File 'lib/errors.rb', line 19 def errors #:nodoc: @errors ||= {} end |
#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.
11 12 13 |
# File 'lib/errors.rb', line 11 def on(attribute) errors[attribute.to_sym] end |