From 77582075a66ca6fcd6959e29b4d6625021e67edf Mon Sep 17 00:00:00 2001 From: Kevin Skoglund Date: Mon, 7 Feb 2011 09:25:22 -0500 Subject: Add note that validates_length_of will incorrectly pluralize min. length 1 --- railties/guides/source/active_record_validations_callbacks.textile | 2 ++ 1 file changed, 2 insertions(+) (limited to 'railties/guides/source') diff --git a/railties/guides/source/active_record_validations_callbacks.textile b/railties/guides/source/active_record_validations_callbacks.textile index a15571fe58..6f857ab9cc 100644 --- a/railties/guides/source/active_record_validations_callbacks.textile +++ b/railties/guides/source/active_record_validations_callbacks.textile @@ -314,6 +314,8 @@ class Essay < ActiveRecord::Base end +Note that the default error messages are plural (e.g., "is too short (minimum is %{count} characters)"). For this reason, when +:minimum+ is 1 you should provide a personalized message or use +validates_presence_of+ instead. When +:in+ or +:within+ have a lower limit of 1, you should either provide a personalized message or call +validates_presence_of+ prior to +validates_length_of+. + The +validates_size_of+ helper is an alias for +validates_length_of+. h4. +validates_numericality_of+ -- cgit v1.2.3