I have a Date
and Time
column separately in the table in my database. When i click the Edit in the table, the Date
and Time
should display the values by params
. The User can change the Date
and the Time
and update the form
.
I tried the following:
<div class="field">
<%= f.label :Sent_Date, 'Sent Date:' %>
<%= date_select(:Appointment_Date, object: f.object) %>
</div>
<div class="field">
<%= f.label :Appointment_Time, 'Appointment Time:' %>
<%= f.time_select(:history, :Appointment_Time, include_seconds: true) %>
</div>
It's not display the values correctly and it doesn't change to next record. It display to select the value. Do I need to convert the date here? Because, In the Database, its just the value like 2013/05/13
and in the field its like 20 December 2013
Time
field is not working. Please suggest me how to get solve this issue.
Thanks
Don't use constants as fields for your model. Any variable starting with a capital letter will be treated like a constant, and constants are meant not to change. Ruby will give you a warning: already initialized constant
when trying to change a constant's value, so that might be the reason you can't change the time and date.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.