Rails - 验证date_select帮助程序

时间:2011-05-13 17:54:24

标签: ruby-on-rails

我正在使用date_select helper,它传递params,如:

date_of_birth(1i)
date_of_birth(2i)
date_of_birth(3i)

我想使用validates_presence_of进行验证,但从下拉列表中选择空白时会返回以下错误:

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.empty?

1 个答案:

答案 0 :(得分:0)

看起来jQuery对我来说是正确的解决方案。 :)