aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/validations.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-06-25 11:24:43 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-06-25 11:24:43 +0000
commit3eed3272d7fc79040b6eb3b8586be0d8875d8203 (patch)
tree6bf65567604faaded9a402b3a6307f96c6bae9b4 /activerecord/lib/active_record/validations.rb
parent55850818e36dce98061c3bbc56b41134f8f0e413 (diff)
downloadrails-3eed3272d7fc79040b6eb3b8586be0d8875d8203.tar.gz
rails-3eed3272d7fc79040b6eb3b8586be0d8875d8203.tar.bz2
rails-3eed3272d7fc79040b6eb3b8586be0d8875d8203.zip
Fixed that validations didn't respecting custom setting for too_short, too_long messages #1437 [Marcel Molina]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1509 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/validations.rb')
-rwxr-xr-xactiverecord/lib/active_record/validations.rb10
1 files changed, 3 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb
index d58502e98b..e42b306e10 100755
--- a/activerecord/lib/active_record/validations.rb
+++ b/activerecord/lib/active_record/validations.rb
@@ -213,12 +213,6 @@ module ActiveRecord
:message => nil
}.freeze
- DEFAULT_SIZE_VALIDATION_OPTIONS = DEFAULT_VALIDATION_OPTIONS.merge(
- :too_long => ActiveRecord::Errors.default_error_messages[:too_long],
- :too_short => ActiveRecord::Errors.default_error_messages[:too_short],
- :wrong_length => ActiveRecord::Errors.default_error_messages[:wrong_length]
- ).freeze
-
ALL_RANGE_OPTIONS = [ :is, :within, :in, :minimum, :maximum ].freeze
def validate(*methods, &block)
@@ -404,7 +398,9 @@ module ActiveRecord
# method, proc or string should return or evaluate to a true or false value.
def validates_length_of(*attrs)
# Merge given options with defaults.
- options = DEFAULT_SIZE_VALIDATION_OPTIONS.dup
+ options = {:too_long => ActiveRecord::Errors.default_error_messages[:too_long],
+ :too_short => ActiveRecord::Errors.default_error_messages[:too_short],
+ :wrong_length => ActiveRecord::Errors.default_error_messages[:wrong_length]}.merge(DEFAULT_VALIDATION_OPTIONS)
options.update(attrs.pop.symbolize_keys) if attrs.last.is_a?(Hash)
# Ensure that one and only one range option is specified.