mike
mike

Reputation: 3519

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 - day, month, and time and have each of their values be combined to form the one date field (a string) in my entry table.

Upvotes: 0

Views: 372

Answers (1)

Jakub Hampl
Jakub Hampl

Reputation: 40533

<%= 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.

Upvotes: 1

Related Questions