简体   繁体   English

Rails-验证date_select助手

[英]Rails - Validating date_select helper

I'm using date_select helper which passes params like: 我正在使用date_select助手,它传递如下参数:

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

I would like to validate using validates_presence_of but returns the following error when blank is selected from the dropdowns: 我想使用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?

Looks like jQuery was the right solution for me. 看起来jQuery是适合我的正确解决方案。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM