diff options
author | Vasiliy Ermolovich <younash@gmail.com> | 2011-12-24 23:40:09 +0300 |
---|---|---|
committer | Vasiliy Ermolovich <younash@gmail.com> | 2011-12-24 23:40:09 +0300 |
commit | fdbd6779fe1a9d54c55b401f4b2a92b5e5ef1e8f (patch) | |
tree | 187774c59a9a9f5e5c91e3e84bb2481e664efb19 /activemodel/lib | |
parent | cf0fd053cd197250abaf693adcdbf9d12f24e350 (diff) | |
download | rails-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.rb | 6 |
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 |