Hi, I''m having a very strange error when using the date_select. This is de code in my view: <%= date_select :user, :birthdate , :order => [:day, :month, :year], :start_year => Time.now.year-120, :end_year => Time.now.year %> This used in the expression user.update_attributes(params[:user]) So, nothing fancy here. But when I give in a date older than 1 january 1970, I get an error: ''1 error(s) on assignment of multiparameter attributes'', which I don''t have with > 1970. I checked the log, and both times the parameters are passed just fine. Anyone has a clue? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Joram wrote:> Anyone has a clue?i use this: <%= date_select :user, :birth , :order => [:day, :month, :year], :start_year => 1900, :end_year => 18.years.ago %> and it works fine -- 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 -~----------~----~----~----~------~----~------~--~---
On Thu, Mar 15, 2007 at 04:07:14AM -0700, Joram wrote :> > So, nothing fancy here. But when I give in a date older than 1 january > 1970, I get an error: > ''1 error(s) on assignment of multiparameter attributes'', which I don''t > have with > 1970.AR uses Time class and not DateTime. See http://wiki.rubyonrails.org/rails/pages/OlderQuestionsOfTheDay (11/17/05) for more informations about this topic. ++ -- ,========================. | Pierre-Alexandre Meyer | | email : pam-1sEOgp2Wo8Qdnm+yROfE0A@public.gmane.org | `========================'' --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Eric: I tried it, but it''s still the same for me when I enter a date < 1970 Pierre-Alexandre: The 1970 should have made me realize it was a problem corresponnding to the class where the time was stored. I read your link, that''s exactly what I need, but how can I apply the patch suggested there? On 15 mrt, 12:35, Pierre-Alexandre Meyer <p...-1sEOgp2Wo8Qdnm+yROfE0A@public.gmane.org> wrote:> On Thu, Mar 15, 2007 at 04:07:14AM -0700, Joram wrote : > > > > > So, nothing fancy here. But when I give in a date older than 1 january > > 1970, I get an error: > > ''1 error(s) on assignment of multiparameter attributes'', which I don''t > > have with > 1970. > > AR uses Time class and not DateTime. Seehttp://wiki.rubyonrails.org/rails/pages/OlderQuestionsOfTheDay > (11/17/05) for more informations about this topic. > > ++ > > -- > ,========================. > | Pierre-Alexandre Meyer | > | email : p...-1sEOgp2Wo8Qdnm+yROfE0A@public.gmane.org | > `========================''--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
change the field type in your table to datetime On 3/15/07, Joram <joram.barrez-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Eric: I tried it, but it''s still the same for me when I enter a date < > 1970 > > Pierre-Alexandre: > The 1970 should have made me realize it was a problem corresponnding > to the class where the time was stored. > I read your link, that''s exactly what I need, but how can I apply the > patch suggested there? > > On 15 mrt, 12:35, Pierre-Alexandre Meyer <p...-1sEOgp2Wo8Qdnm+yROfE0A@public.gmane.org> wrote: > > On Thu, Mar 15, 2007 at 04:07:14AM -0700, Joram wrote : > > > > > > > > > So, nothing fancy here. But when I give in a date older than 1 january > > > 1970, I get an error: > > > ''1 error(s) on assignment of multiparameter attributes'', which I don''t > > > have with > 1970. > > > > AR uses Time class and not DateTime. > Seehttp://wiki.rubyonrails.org/rails/pages/OlderQuestionsOfTheDay > > (11/17/05) for more informations about this topic. > > > > ++ > > > > -- > > ,========================. > > | Pierre-Alexandre Meyer | > > | email : p...-1sEOgp2Wo8Qdnm+yROfE0A@public.gmane.org | > > `========================'' > > > > >-- irfani YM : irfani_s http://irfani.web.id --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
It already is, unfortunately: create_table :users do |t| t.column ''username'', :string, :null => false t.column ''name'', :string t.column ''birthdate'', :datetime end But thanks for your input! On 15 mrt, 15:36, irfaniYangBaikHati <irfani...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> change the field type in your table to datetime > > On 3/15/07, Joram <joram.bar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > Eric: I tried it, but it''s still the same for me when I enter a date < > > 1970 > > > Pierre-Alexandre: > > The 1970 should have made me realize it was a problem corresponnding > > to the class where the time was stored. > > I read your link, that''s exactly what I need, but how can I apply the > > patch suggested there? > > > On 15 mrt, 12:35, Pierre-Alexandre Meyer <p...-1sEOgp2Wo8Qdnm+yROfE0A@public.gmane.org> wrote: > > > On Thu, Mar 15, 2007 at 04:07:14AM -0700, Joram wrote : > > > > > So, nothing fancy here. But when I give in a date older than 1 january > > > > 1970, I get an error: > > > > ''1 error(s) on assignment of multiparameter attributes'', which I don''t > > > > have with > 1970. > > > > AR uses Time class and not DateTime. > > Seehttp://wiki.rubyonrails.org/rails/pages/OlderQuestionsOfTheDay > > > (11/17/05) for more informations about this topic. > > > > ++ > > > > -- > > > ,========================. > > > | Pierre-Alexandre Meyer | > > > | email : p...-1sEOgp2Wo8Qdnm+yROfE0A@public.gmane.org | > > > `========================'' > > -- > irfani > > YM : irfani_shttp://irfani.web.id--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Joram, Did you sort this one out? I''m stuck with exactly the same issue. -- 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 -~----------~----~----~----~------~----~------~--~---
If you use a date datatype at least in sqlite3 and sqlserver, you should be in good shape. Just remember that any calculations must be done with the Date class. change_column :users, :birthdate, :date Also, you might find this handy User''s age in view: <%=h ((Date.today - @user.date_of_birth)/365.25).round %> Cheers, Simon -- 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 -~----------~----~----~----~------~----~------~--~---