aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2011-05-16 14:31:00 +0900
committerAkira Matsuda <ronnie@dio.jp>2011-05-16 15:37:44 +0900
commitcbe1d2488b12460dd752a3805ea813f37e4fe94e (patch)
treefdce9f5b6450baf4e6eb3effd3e389673c293990 /activemodel
parent8b0262f9535cb9ad2215e5ed672150e2c52cb4b4 (diff)
downloadrails-cbe1d2488b12460dd752a3805ea813f37e4fe94e.tar.gz
rails-cbe1d2488b12460dd752a3805ea813f37e4fe94e.tar.bz2
rails-cbe1d2488b12460dd752a3805ea813f37e4fe94e.zip
Don't add DEFAULT_TOKENIZER to every instance of LengthValidator. Just use it only when needed.
Diffstat (limited to 'activemodel')
-rw-r--r--activemodel/lib/active_model/validations/length.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/validations/length.rb b/activemodel/lib/active_model/validations/length.rb
index 72735cfb89..d595a5fb43 100644
--- a/activemodel/lib/active_model/validations/length.rb
+++ b/activemodel/lib/active_model/validations/length.rb
@@ -16,7 +16,7 @@ module ActiveModel
options[:maximum] -= 1 if range.exclude_end?
end
- super(options.reverse_merge(:tokenizer => DEFAULT_TOKENIZER))
+ super
end
def check_validity!
@@ -36,7 +36,7 @@ module ActiveModel
end
def validate_each(record, attribute, value)
- value = options[:tokenizer].call(value) if value.kind_of?(String)
+ value = (options[:tokenizer] || DEFAULT_TOKENIZER).call(value) if value.kind_of?(String)
CHECKS.each do |key, validity_check|
next unless check_value = options[key]