Permalink
Browse files

don't call an extra method if options[:tokenizer] is not present

  • Loading branch information...
1 parent cf0fd05 commit fdbd6779fe1a9d54c55b401f4b2a92b5e5ef1e8f @nashby nashby committed Dec 24, 2011
Showing with 2 additions and 4 deletions.
  1. +2 −4 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 fdbd677

Please sign in to comment.