Rails: Don't save date if it wasn't changed
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
加载中,请稍侯......
精彩评论