mazurr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Oct-16 22:53 UTC
Handling Date Fields (date_select tutorial?)
Summary: is there a "how-to" somewhere that show how to use date_select? I have been going round and round trying to figure out how to capture and edit dates using ROR''s built-in functionality. If I am just binding a database date field to the model object and use the standard view (ie. not using date_select), that works fine. But as soon as I replace (override) the new or edit view and have to create the date capture/edit functionality myself, I am lost.>From googling the past few hours, I understand I should (could) use thedate_select widget. But I can only find info of people talking about it rather than "this is what you put in your html (for initial capture and edit), and this is what your controller or model object needs to handle that data". I have been using trial and error to get a simple date_select to work, but am getting no where. Does anyone know of a simple how-to on the internet, because I am not finding it. Thanks, Rob --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
mazurr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Oct-16 23:14 UTC
Re: Handling Date Fields (date_select tutorial?)
I answered my own question. I was trying to make it more complicated than it needed to be. For others that try this after me, all you need to do is....instead of putting into your html the usual <input .....> form element, simply put: <%= date_select ''your_model_name'', ''your_date_field_name'', {:order => [:month, :day, :year]} %> Do this in your "new" as well as "edit" views, and everything else is taken care of. Thanks, Rob --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---