Rails multiple select boxes for one database field
Okay so I am creating a web app thats essentially a workout journal. I created a database table for each entry that holds the date, workoutname, exercises, etc... I was wondering if in my form for creating a new entry I can create 3 drop down lists for the date开发者_JAVA百科 - day, month, and time and have each of their values be combined to form the one date field (a string) in my entry table.
<%= f.datetime_select :workout_at %>
does that for you. If you need to do that manually inspect the html output this has and mimic it in your code. See also http://apidock.com/rails/ActionView/Helpers/DateHelper/datetime_select.
精彩评论