From 31199a9e4af79f5d609bc6446e40e5f4ac03bb61 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 28 Mar 2006 01:11:09 +0000 Subject: Update description git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4074 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/CHANGELOG | 2 +- activerecord/lib/active_record/validations.rb | 6 +++--- activerecord/test/validations_test.rb | 28 +++++++++++++-------------- 3 files changed, 18 insertions(+), 18 deletions(-) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 944c4acf2a..f90ba96bd1 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -2106,7 +2106,7 @@ in effect. Added :readonly finder constraint. Calling an association collectio end end - This will add an error to the tune of "is too short (min is 3 characters)" or "is too long (min is 20 characters)" if + This will add an error to the tune of "is too short (minimum is 3 characters)" or "is too long (minimum is 20 characters)" if the password is outside the boundry. The messages can be changed by passing a third and forth parameter as message strings. * Implemented a clone method that works properly with AR. It returns a clone of the record that diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index e206dfbbf1..c5c38ff4fd 100755 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -31,8 +31,8 @@ module ActiveRecord :accepted => "must be accepted", :empty => "can't be empty", :blank => "can't be blank", - :too_long => "is too long (max is %d characters)", - :too_short => "is too short (min is %d characters)", + :too_long => "is too long (maximum is %d characters)", + :too_short => "is too short (minimum is %d characters)", :wrong_length => "is the wrong length (should be %d characters)", :taken => "has already been taken", :not_a_number => "is not a number" @@ -415,7 +415,7 @@ module ActiveRecord # * in - A synonym(or alias) for :within # * allow_nil - Attribute may be nil; skip validation. # - # * too_long - The error message if the attribute goes over the maximum (default is: "is too long (max is %d characters)") + # * too_long - The error message if the attribute goes over the maximum (default is: "is too long (maximum is %d characters)") # * too_short - The error message if the attribute goes under the minimum (default is: "is too short (min is %d characters)") # * wrong_length - The error message if using the :is method and the attribute is the wrong size (default is: "is the wrong length (should be %d characters)") # * message - The error message to use for a :minimum, :maximum, or :is violation. An alias of the appropriate too_long/too_short/wrong_length message diff --git a/activerecord/test/validations_test.rb b/activerecord/test/validations_test.rb index 2b913bda22..d7ba74597c 100755 --- a/activerecord/test/validations_test.rb +++ b/activerecord/test/validations_test.rb @@ -156,11 +156,11 @@ class ValidationsTest < Test::Unit::TestCase def test_errors_on_boundary_breaking developer = Developer.new("name" => "xs") assert !developer.save - assert_equal "is too short (min is 3 characters)", developer.errors.on("name") + assert_equal "is too short (minimum is 3 characters)", developer.errors.on("name") developer.name = "All too very long for this boundary, it really is" assert !developer.save - assert_equal "is too long (max is 20 characters)", developer.errors.on("name") + assert_equal "is too long (maximum is 20 characters)", developer.errors.on("name") developer.name = "Just right" assert developer.save @@ -402,17 +402,17 @@ class ValidationsTest < Test::Unit::TestCase t.title = "not" assert !t.valid? assert t.errors.on(:title) - assert_equal "is too short (min is 5 characters)", t.errors["title"] + assert_equal "is too short (minimum is 5 characters)", t.errors["title"] t.title = "" assert !t.valid? assert t.errors.on(:title) - assert_equal "is too short (min is 5 characters)", t.errors["title"] + assert_equal "is too short (minimum is 5 characters)", t.errors["title"] t.title = nil assert !t.valid? assert t.errors.on(:title) - assert_equal "is too short (min is 5 characters)", t.errors["title"] + assert_equal "is too short (minimum is 5 characters)", t.errors["title"] end def test_optionally_validates_length_of_using_minimum @@ -434,7 +434,7 @@ class ValidationsTest < Test::Unit::TestCase t.title = "notvalid" assert !t.valid? assert t.errors.on(:title) - assert_equal "is too long (max is 5 characters)", t.errors["title"] + assert_equal "is too long (maximum is 5 characters)", t.errors["title"] t.title = "" assert t.valid? @@ -458,14 +458,14 @@ class ValidationsTest < Test::Unit::TestCase t = Topic.new("title" => "a!", "content" => "I'm ooooooooh so very long") assert !t.valid? - assert_equal "is too short (min is 3 characters)", t.errors.on(:title) - assert_equal "is too long (max is 5 characters)", t.errors.on(:content) + assert_equal "is too short (minimum is 3 characters)", t.errors.on(:title) + assert_equal "is too long (maximum is 5 characters)", t.errors.on(:content) t.title = nil t.content = nil assert !t.valid? - assert_equal "is too short (min is 3 characters)", t.errors.on(:title) - assert_equal "is too short (min is 3 characters)", t.errors.on(:content) + assert_equal "is too short (minimum is 3 characters)", t.errors.on(:title) + assert_equal "is too short (minimum is 3 characters)", t.errors.on(:content) t.title = "abe" t.content = "mad" @@ -662,7 +662,7 @@ class ValidationsTest < Test::Unit::TestCase t.title = "一二三四" assert !t.valid? assert t.errors.on(:title) - assert_equal "is too short (min is 5 characters)", t.errors["title"] + assert_equal "is too short (minimum is 5 characters)", t.errors["title"] end end @@ -676,7 +676,7 @@ class ValidationsTest < Test::Unit::TestCase t.title = "一二34五六" assert !t.valid? assert t.errors.on(:title) - assert_equal "is too long (max is 5 characters)", t.errors["title"] + assert_equal "is too long (maximum is 5 characters)", t.errors["title"] end end @@ -686,8 +686,8 @@ class ValidationsTest < Test::Unit::TestCase t = Topic.new("title" => "一二", "content" => "12三四五六七") assert !t.valid? - assert_equal "is too short (min is 3 characters)", t.errors.on(:title) - assert_equal "is too long (max is 5 characters)", t.errors.on(:content) + assert_equal "is too short (minimum is 3 characters)", t.errors.on(:title) + assert_equal "is too long (maximum is 5 characters)", t.errors.on(:content) t.title = "一二三" t.content = "12三" assert t.valid? -- cgit v1.2.3