开发者

Rails: Don't save date if it wasn't changed

开发者 https://www.devze.com 2023-01-09 00:01 出处:网络
I have a class wi开发者_运维问答th a date. If the user doesn\'t change it in the view, Rails saves today\'s date (the default values in the drop downs). I would like it to be saved as a null value ins

I have a class wi开发者_运维问答th a date. If the user doesn't change it in the view, Rails saves today's date (the default values in the drop downs). I would like it to be saved as a null value instead. How do I do this?


You can use :include_blank in your date_select helper. Reference: http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#M002264

0

精彩评论

暂无评论...
验证码 换一张
取 消