add(attribute, msg = @@default_error_messages[:invalid]) Ver: 1.1.1
From: ActiveRecord::Errors
Version 1.1.1
Comments
Adds an error message (msg) to the attribute, which 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 error can be added to the same attribute in which
case an array will be returned on a call to on(attribute). If no
msg is supplied, "invalid" is assumed.
Sourcecode
# File src/rails-1.1.1/activerecord/lib/active_record/validations.rb, line 57def add(attribute,msg=@@default_error_messages[:invalid])@errors[attribute.to_s]=[]if@errors[attribute.to_s].nil?@errors[attribute.to_s]<<msgend
Adds an error message (msg) to the attribute, which 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 error can be added to the same attribute in which case an array will be returned on a call to on(attribute). If no msg is supplied, "invalid" is assumed.