Skip to content
Browse files

Merge pull request #4172 from nashby/refactor-tokenizer

don't call an extra method if options[:tokenizer] is not present
  • Loading branch information...
2 parents 0d7c375 + fdbd677 commit b28ed2bd4fb094c9420d14b858cebb47373e48d8 @josevalim josevalim committed Dec 24, 2011
Showing with 2 additions and 4 deletions.
  1. +2 −4 activemodel/lib/active_model/validations/length.rb
View
6 activemodel/lib/active_model/validations/length.rb
@@ -56,10 +56,8 @@ def validate_each(record, attribute, value)
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

0 comments on commit b28ed2b

Please sign in to comment.
Something went wrong with that request. Please try again.