All morning and last night I have had to work with this bug / or my fault in the following : I wish for the user to select an arrival date (m/d/y); the arrival date is of type datetime. when I have Arrives :<%= pu.datetime_select :arrives %> it gives me the hour and minutes. I can capture the arrival date and see it being displayed in the controller when I do a logger.debug ( ">>> arrives #{@unit.arrives}") I dont want the user to set the hour and minute though (important) So I type in : Arrives : <%= pu.datetime_select(:arrives, :discard_hour=>true %> This results in arrival date not being captured; now when I do a logger.debug ( ">>> arrives #{@unit.arrives}") I get nothing. I have tried various permutations and combinations :discard_minute=>true etc. and it just doesnt seem to work with :discard_hour=>true What am I doing wrong here? -- 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 -~----------~----~----~----~------~----~------~--~---
browse here : http://railsapi.org/actionview-helpers-datehelper-datetime_select reinhart http://teapoci.blogspot.com -- 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 -~----------~----~----~----~------~----~------~--~---
Rails Terrorist wrote:> browse here : > > http://railsapi.org/actionview-helpers-datehelper-datetime_select > > reinhart > http://teapoci.blogspot.comWhat does that mean? Does it mean that datetime does not have a :discard_hour=>true option? I notice this option here : http://dev.rubyonrails.org/ticket/2089 I even tried this : http://www.methods.co.nz/rails_date_kit/rails_date_kit.html but that does not work (tried all kinds of permutations/ combinations). Any other usable interfaces/plugins would be cool. Wait a second that is a similar response you gave to this guy : http://www.ruby-forum.com/topic/151166#new I am sure people can READ the apis my friend. This particular version does not mention any discard_hour option either :http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#M001011 However rails way by Obie Fernandez (2008) on page 415 says : datetime_select(object_name, method, options = {}) Works exactly like date_select, except for the addition of hour and minute select tags. Seconds may be added with the option :include_seconds. Along with the addition of time information come additional discarding options: :discard_hour, :discard_minute, and :discard_seconds. -- So please a little clarity would be great. Attachments: http://www.ruby-forum.com/attachment/2098/The_Rails_Way__2008_415.pdf -- 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 -~----------~----~----~----~------~----~------~--~---
Calm down Bro, i think you are too hurry to interpret of written in my url :D I can see your stressful here. man... you should make it like hashing, you can not use : <%= pu.datetime_select(:arrives, :discard_hour=>true %> But if you use : <%= pu.datetime_select(:bus, :arrives, :discard_hour=>true %> It would be working 100% that is why i gave you : http://railsapi.org/actionview-helpers-datehelper-datetime_select Cheer, Reinhart http://teapoci.blogspot.com -- 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 -~----------~----~----~----~------~----~------~--~---
I tried what you told me already (as I said I read the API and tried various permutations) but it doesnt work. This is the error I am getting when I try to do it again upon your kind suggestion (thanks for your response though, I dont want to belittle your kindness or your response): ArgumentError in Psos#new Showing psos/new.html.erb where line #51 raised: wrong number of arguments (3 for 2) Extracted source (around line #51): 48: </tr> 49: <tr bgcolor=#CCCCCC> 50: <td> 51: Arrives : </td><td colspan=3><%= pu.datetime_select (:pso_unit, :arrives ,:discard_hour=>true, :order=>[:month,:day,:year]) %></td> 52: <!--<%= pu.datetime_select(:arrives, :discard_minute=>true, :discard_hour=>true, :default=>DateTime.now, 53: :order=>[:month,:day,:year]) %>--> 54: </tr> RAILS_ROOT: C:/ruby/letter4sure Application Trace | Framework Trace | Full Trace Rails Terrorist wrote:> Calm down Bro, i think you are too hurry to interpret of written in my > url :D > > I can see your stressful here. > > man... you should make it like hashing, you can not use : > <%= pu.datetime_select(:arrives, :discard_hour=>true %> > > But if you use : > <%= pu.datetime_select(:bus, :arrives, :discard_hour=>true %> > > It would be working 100% > > that is why i gave you : > > http://railsapi.org/actionview-helpers-datehelper-datetime_select > > > Cheer, > Reinhart > http://teapoci.blogspot.com-- 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 -~----------~----~----~----~------~----~------~--~---
calm down bro... you did not read your script carefully :) you have made mistake here : <%= pu.datetime_select (:pso_unit, :arrives ,:discard_hour=>true, :order=>[:month,:day,:year]) %> The correct script is <%= datetime_select (:pso_unit, :arrives ,:discard_hour=>true, :order=>[:month,:day,:year]) %> Dont ask me why. I can answer it, but i need you to find answer of this matter by your self. Because you are impatient programmer and careless :D Cheer, Reinhart http://teapoci.blogspot.com -- 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 -~----------~----~----~----~------~----~------~--~---
Rails Terrorist wrote:> you have made mistake here : > > <%= pu.datetime_select (:pso_unit, :arrives ,:discard_hour=>true, > :order=>[:month,:day,:year]) %> > The correct script is > <%= datetime_select (:pso_unit, :arrives ,:discard_hour=>true, > :order=>[:month,:day,:year]) %>I tried that before I tried pu.datetime_select... <%= datetime_select(:pso_unit, :arrives, :discard_hour=>true, :default=>DateTime.now, :order=>[:month,:day,:year]) %> does not work either. This works : <%= pu.datetime_select :arrives , :order=>[:month,:day,:year] %> however the moment I add :discard_hour=>true, I can no longer read the date in the arrives field. I can email the mvc to you. Lastly just a gentle request : would you be nice enough to please not label me as you try to help me , thanks! :) appreciate your kindness. -- 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 -~----------~----~----~----~------~----~------~--~---
i dont know what is your exactly problem there because i implemented your script with/out pu and I have always been success without error. You can email me at booking2heaven-/E1597aS9LQAvxtiuMwx3w@public.gmane.org or upload it here. Regards Reinhart -- 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 -~----------~----~----~----~------~----~------~--~---
<%= datetime_select(:pso_unit, :arrives, :discard_hour=>true, :default=>DateTime.now, :order=>[:month,:day,:year]) %> it works here to me If you dont want user set hour and minutes, why you not only use select_date ?? or a plugin like toolbocks (calendar). Reinhart -- 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 -~----------~----~----~----~------~----~------~--~---
Rails Terrorist wrote:> <%= datetime_select(:pso_unit, :arrives, :discard_hour=>true, > :default=>DateTime.now, :order=>[:month,:day,:year]) %> > > it works here to me > > If you dont want user set hour and minutes, why you not only use > select_date ?? or a plugin like toolbocks (calendar). > > ReinhartOk then there must be something wrong with my environment/setup or application. I could send you the code and the data dump if you wish. I am not using date as opposed to datetime for extensibility reasons. Thanks for the tip on datetime toolbocks... that is what I was looking for. -- 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 -~----------~----~----~----~------~----~------~--~---
Ather Shiraz wrote:> Rails Terrorist wrote: >> <%= datetime_select(:pso_unit, :arrives, :discard_hour=>true, >> :default=>DateTime.now, :order=>[:month,:day,:year]) %> >> >> it works here to me >> >> If you dont want user set hour and minutes, why you not only use >> select_date ?? or a plugin like toolbocks (calendar). >> >> Reinhart > > Ok then there must be something wrong with my environment/setup or > application. I could send you the code and the data dump if you wish. > > I am not using date as opposed to datetime for extensibility reasons. > Thanks for the tip on datetime toolbocks... that is what I was looking > for.BTW the datetime_select is embedded in this form : <% form_for :pso, :url=> {:action=>:create} do |f| %> <% fields_for :pso_unit do |pu| %> ... <%= datetime_select(:pso_unit, :arrives, :discard_hour=>true, :default=>DateTime.now, :order=>[:month,:day,:year]) %> <%end> <%end %> -- 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 -~----------~----~----~----~------~----~------~--~---