Hello Rails board, I''ve been poking around the documentation, but I can''t seem to find what I''m looking for. Also, all the code below is the standard scaffold stuff (besides my helper method). Basically, my problem is this: I have a string field on my "Event" model which is called "start_time". I tried using a datetime data type, but I don''t like the time select widgets that Rails provides. Basically, the widget I need is [hour][min][am|pm]. I tried rolling my own multiselect, and I got it to show up in the UI the way I wantedm but the problem I''m having is that only value from the first drop-down (i.e. the hour) is getting saved to the database. I realize that I''m missing a step here somewhere, so I''m hoping someone could point me in the right direction. Thank you! For reference, here is what I tried to use: - View (from _form.rhtml) - <p><label for="event_start_time">Start time</label><br/> <%= my_time_select ''event'', ''start_time'' %></p> - My Helper Method - module CalendarHelper def my_time_select(object, method) #Hour, minutes, ampm select(object, method, hour_opts, :include_blank => true, :selected => nil) + select(object, method, %w{00 15 30 45}, :include_blank => true, :selected => nil) + select(object, method, %w{am pm}, :include_blank => true, :selected => nil) end private def hour_opts hours = [] 1.upto(12) {|hour| hours << hour} return hours end end - The create() method that is getting called - @event = Event.new(params[:event]) So...what am I missing? I''m guessing the problem is with my create method in the controller. Thanks all! -kodama -- 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?hl=en -~----------~----~----~----~------~----~------~--~---
Old Echo
2007-Dec-10 02:20 UTC
Re: Concatenate multiple drop down values into a single stri
Hey guys, I need a hand - no-one''s run into this before? kodama -- 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?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg
2007-Dec-10 02:51 UTC
Re: Concatenate multiple drop down values into a single stri
Why not just use time_select? On Dec 10, 2007 12:50 PM, Old Echo <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hey guys, > I need a hand - no-one''s run into this before? > > kodama > -- > Posted via http://www.ruby-forum.com/. > > > >-- Ryan Bigg http://www.frozenplague.net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Old Echo
2007-Dec-10 05:25 UTC
Re: Concatenate multiple drop down values into a single stri
I checked it out, but I don''t like how the hours go from 0 to 23. Also, I need to have the time select show up as [hour][min][am|pm]. Do you know what I''m doing wrong in my widget? Ryan Bigg wrote:> Why not just use time_select? > > On Dec 10, 2007 12:50 PM, Old Echo <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > >> >> Hey guys, >> I need a hand - no-one''s run into this before? >> >> kodama >> -- >> Posted via http://www.ruby-forum.com/. >> >> > >> > > > -- > Ryan Bigg > http://www.frozenplague.net-- 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?hl=en -~----------~----~----~----~------~----~------~--~---