【发布时间】:2010-11-06 13:39:16
【问题描述】:
我最近在我的设计注册页面中添加了一个出生日期字段,并使用 validates_timeliness 检查日期是否正确。但是,如果日期留空,我会收到以下错误,不知道如何解决。
* Date of birth translation missing: en, activerecord, errors, models, user, attributes, date_of_birth, invalid_date
* Date of birth translation missing: en, activerecord, errors, models, user, attributes, date_of_birth, invalid_date
控制器
#validates_timeliness gem is used for validates_date
validates_date :date_of_birth, :before => lambda { 18.years.ago }, :before_message => "must be at least 18 years old"
validates_date :date_of_birth, :after => lambda { 106.years.ago }, :before_message => "Seriously, dude. You ain't that old."
validates_acceptance_of :terms_of_service, :accept => true
validates_presence_of :gender_id
如果您需要查看表格,请在实际操作中查看。 http://hangwith.me/account/register
【问题讨论】:
标签: ruby-on-rails devise