Martin Maciaszek
2007-Apr-25 12:44 UTC
using date_select helper without an ActiveRecord model?
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? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---