提交 cec60d39 编写于 作者: G Guillermo Iguaran

validate_each in NumericalityValidator is never called in this case.

NumericalityValidator#validate_each is never called when allow_nil is true and
the value is nil because it is already skipped in EachValidator#validate.
上级 43f1b23a
......@@ -26,8 +26,6 @@ def validate_each(record, attr_name, value)
raw_value = value
end
return if options[:allow_nil] && raw_value.nil?
unless is_number?(raw_value)
record.errors.add(attr_name, :not_a_number, filtered_options(raw_value))
return
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册