I would like to use a date_select helper to select a date that will be used as a part of a condition in an ActiveRecord::find. The code I'm using looks like this: <%= date_select :calendar, :show_month, :order => [:month, :year] %> How do I get a Date object from the params submitted? I ended up with code that looks like this: calendar = params[:calendar] my_date = Date.new(calendar['show_month(1i)'].to_i,calendar['show_month(2i)'].to_i,calendar['show_month(3i)'].to_i) This looks pretty ughly. There has to be a simpler and cleaner way to do this. On the other hand I want the date_select helper to have a certain date preselected. Not having an ActiveRecord object how does the object need to look like so date_select will be able to extract the date from it?
on 2007-04-25 14:44