class ActiveRecord::Errors
def add(attribute, message = nil, options = {})
If +message+ is a Symbol, it will be translated, using the appropriate scope (see translate_error).
If no +messsage+ is supplied, :invalid is assumed.
error can be added to the same +attribute+ in which case an array will be returned on a call to on(attribute).
for the same attribute and ensure that this error object returns false when asked if empty?. More than one
Adds an error message (+messsage+) to the +attribute+, which will be returned on a call to on(attribute)
def add(attribute, message = nil, options = {}) options[:message] = options.delete(:default) if options[:default].is_a?(Symbol) error, message = message, nil if message.is_a?(Error) @errors[attribute.to_s] ||= [] @errors[attribute.to_s] << (error || Error.new(@base, attribute, message, options)) end