What is the best way to update a datetime field in a form.
I have a form and need to update both the date and the time.
I need to update the date with a date_select and then update the time using a time_select
I only have 1 field in my database. Event:date
I need to save the date in one field and then update the same field but add the date.
It has to be that way for the user to pick them separately. But it has to be one table in the database for the calendar.
--------------Form
Select Date : Dateselect saving to db:field :Starttime
Select Time : Timeselect saving 开发者_运维技巧to db:field :Starttime
There's select_datetime
for this:
http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#M001701
Try using the calendar_date_select
gem. It lets you select date and/or time with one control.
http://code.google.com/p/calendardateselect/
精彩评论