hi all, i have a user object that includes a birthday datetime field. when the user is created, he selects the date via the helper datetime_select ''user'', ''birthday'' which works great. the date is saved to the database, and it works great...but when i display the datetime_select helper after the user is created, the correct date isn''t displayed - - the previous time is selected. how do i place the user''s birth-date as the selected date? i tried datetime_select ''user'', ''birthday'', :value => @session[''user''].birthday but that didn''t work... what am i supposed to do?? i googled around, and couldn''t find any answer... any help, is much appreciated. thanks, harp -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
how does rails automaticly choose the correct date to display, according to the object, when using the date_select helper? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
harp wrote:> hi all, > > i have a user object that includes a birthday datetime field. > when the user is created, he selects the date via the helper > > datetime_select ''user'', ''birthday'' > > which works great. the date is saved to the database, and it works > great...but when i display the datetime_select helper after the user is > created, the correct date isn''t displayed - - the previous time is > selected. > > how do i place the user''s birth-date as the selected date? > > i tried > > datetime_select ''user'', ''birthday'', :value => @session[''user''].birthdayIn your controller you''ve got to set @user = session[''user''] -- We develop, watch us RoR, in numbers too big to ignore. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
<% @user = @session[''user''] %>>> datetime_select ''user'', ''birthday'', :value => @session[''user''].birthdayit works! thanks! isn''t there any way to assign it a value if i want to [not according to the user object] ? something like : date_select ''user'', ''birthday'', :selected => a_certain_date ? anyhow, it seems to work now, so, thanks. . . harp -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
harp wrote:> <% @user = @session[''user''] %> > >>>datetime_select ''user'', ''birthday'', :value => @session[''user''].birthday > > > it works! thanks! > isn''t there any way to assign it a value if i want to [not according to > the user object] ? something like : > > date_select ''user'', ''birthday'', :selected => a_certain_dateIf you''re using date_select, change the displayed date by modifying the attribute on the @user object. Use select_date if you instead wish to select a date unrelated to an AR object. -- We develop, watch us RoR, in numbers too big to ignore. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---