I use the rails helper, which creates 3 selection lists in order to give the user the ability to select a date. If I give the helper a name, he sets all 3 select lists to have that name, and then only the last one passes (he overwrites the previous one). I need to know that: What is the best way to take a set of 3 selection lists (day, month, year) and combine them to create a date object and store it in my database?
Here is my date field:
<%= select_date Date.today, { :order => [:month, :day, :year], :start_year => Date.today.year, :end_year => Date.today.year + 3 } %>
and here are the parameters passed to my controller (spat out from my logbook)
Parameters: {"date"=>{"month"=>"4", "day"=>"9", "year"=>"2009"},
"action"=>"create", "controller"=>"shows",
"show"=>{"headline"=>"for example, \"Parking lot is next to the bookstore on Main Street\"", "venue_id"=>{"venue_id"=>""}, "cents"=>"00", "dollars"=>"00"},
"user_id"=>"3", "load_in"=>"-2", "show_time"=>"-2", "query"=>"Type venue name & location here...", "doors"=>"-2"}
As you can see, the date is being transmitted. Ideally, I would like the date to be passed to me as an acceptable date object for my controller. Also, I would like it to be passed in the show hash, as this is show data. Is this possible with some simple rail modifications? Or do I need to write some JS (... a little dirty for this solution, in my opinion)?