Class: Validatable::Errors

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/errors.rb

Instance Method Summary collapse

Instance Method Details

#add(attribute, message) ⇒ Object

:nodoc:



15
16
17
# File 'lib/errors.rb', line 15

def add(attribute, message) #:nodoc:
  errors[attribute.to_sym] = message
end

#errorsObject

: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