aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorVasiliy Ermolovich <younash@gmail.com>2011-12-24 23:40:09 +0300
committerVasiliy Ermolovich <younash@gmail.com>2011-12-24 23:40:09 +0300
commitfdbd6779fe1a9d54c55b401f4b2a92b5e5ef1e8f (patch)
tree187774c59a9a9f5e5c91e3e84bb2481e664efb19 /activemodel/lib
parentcf0fd053cd197250abaf693adcdbf9d12f24e350 (diff)
downloadrails-fdbd6779fe1a9d54c55b401f4b2a92b5e5ef1e8f.tar.gz
rails-fdbd6779fe1a9d54c55b401f4b2a92b5e5ef1e8f.tar.bz2
rails-fdbd6779fe1a9d54c55b401f4b2a92b5e5ef1e8f.zip
don't call an extra method if options[:tokenizer] is not present
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/validations/length.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/activemodel/lib/active_model/validations/length.rb b/activemodel/lib/active_model/validations/length.rb
index f91fc3a750..0eba241333 100644
--- a/activemodel/lib/active_model/validations/length.rb
+++ b/activemodel/lib/active_model/validations/length.rb
@@ -56,10 +56,8 @@ module ActiveModel
private
def tokenize(value)
- if value.kind_of?(String)
- if options[:tokenizer]
- options[:tokenizer].call(value)
- end
+ if options[:tokenizer] && value.kind_of?(String)
+ options[:tokenizer].call(value)
end || value
end
end