我想在 Ruby on Rails 中验证我的模型中的日期,但是,当日期、月份和年份的值到达我的模型时,它们已经被转换成了不正确的日期。
例如,如果我在视图中输入2009年2月31日,当我在控制器中使用 Model.new(params[:model])
时,它会将其转换为“ March 3rd 2009”,然后我的模型将其视为有效日期,它是有效的,但它是不正确的。
我希望能够在我的模型中进行验证。有没有可能我可以,或者我是不是完全搞错了?
我发现这个“ 日期确认”讨论的问题,但它从来没有得到解决。