1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Refactor length validation

This commit is contained in:
Santiago Pastorino 2011-03-12 21:10:19 -02:00
parent f48d3d4df6
commit 157c37f558
2 changed files with 6 additions and 6 deletions

View file

@ -43,8 +43,8 @@ module ActiveModel
value ||= [] if key == :maximum
next if value.kind_of?(Fixnum) && value.to_s.size.send(validity_check, check_value)
next if value && value.size.send(validity_check, check_value)
value_length = value.respond_to?(:length) ? value.length : value.to_s.length
next if value_length.send(validity_check, check_value)
errors_options = options.except(*RESERVED_OPTIONS)
errors_options[:count] = check_value