aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/errors.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2010-06-01 16:39:05 -0500
committerDavid Heinemeier Hansson <david@loudthinking.com>2010-06-01 16:39:05 -0500
commitcae25199008bc26d215e7af5558cfcdfdc6ec264 (patch)
tree9b1cd9bf1a2a770af31406652362001460816e5b /activemodel/lib/active_model/errors.rb
parentd57397c4b62b6474ff8eb55bfd763f5e6dcdcd40 (diff)
parenta0bb1dda119a7488b8a4d61b354a64e619b0d1b3 (diff)
downloadrails-cae25199008bc26d215e7af5558cfcdfdc6ec264.tar.gz
rails-cae25199008bc26d215e7af5558cfcdfdc6ec264.tar.bz2
rails-cae25199008bc26d215e7af5558cfcdfdc6ec264.zip
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'activemodel/lib/active_model/errors.rb')
-rw-r--r--activemodel/lib/active_model/errors.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb
index 14afc5265f..15d468f5d8 100644
--- a/activemodel/lib/active_model/errors.rb
+++ b/activemodel/lib/active_model/errors.rb
@@ -170,13 +170,13 @@ module ActiveModel
end
end
- # Adds an error message (+messsage+) to the +attribute+, which will be returned on a call to <tt>on(attribute)</tt>
- # for the same attribute and ensure that this error object returns false when asked if <tt>empty?</tt>. More than one
- # error can be added to the same +attribute+ in which case an array will be returned on a call to <tt>on(attribute)</tt>.
- # If no +messsage+ is supplied, :invalid is assumed.
+ # Adds +message+ to the error messages on +attribute+, which will be returned on a call to
+ # <tt>on(attribute)</tt> for the same attribute. More than one error can be added to the same
+ # +attribute+ in which case an array will be returned on a call to <tt>on(attribute)</tt>.
+ # If no +message+ is supplied, <tt>:invalid</tt> is assumed.
#
- # If +message+ is a Symbol, it will be translated, using the appropriate scope (see translate_error).
- # If +message+ is a Proc, it will be called, allowing for things like Time.now to be used within an error
+ # If +message+ is a symbol, it will be translated using the appropriate scope (see +translate_error+).
+ # If +message+ is a proc, it will be called, allowing for things like <tt>Time.now</tt> to be used within an error.
def add(attribute, message = nil, options = {})
message ||= :invalid
message = generate_message(attribute, message, options) if message.is_a?(Symbol)