In my date_select if I choose 31 april 2008, it converts it for 1st may 2008 which it seems odd for me? I say odd because first its difficult to validate at the model level, I have to hook some code in the controller and secondly when I finally get the validation errors I have to go back at the edit page and show the selected date(and the error message) which should be 31 april 2008 but the date is now 1st april 2008. Any suggestion? I know it should be better to have a calendar instead of a date_select but I can''t. -- 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''m not sure about that "should be 31 April" since every April I''ve ever experienced has only had 30 days. Your first statement "it converts it for 1st may" actually seems to be correct behavior if you''re riding on time''s arrow. Rick On Oct 31, 5:44 am, Rémi Gagnon <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> In my date_select if I choose 31 april 2008, it converts it for 1st may > 2008 which it seems odd for me? > > I say odd because first its difficult to validate at the model level, I > have to hook some code in the controller and secondly when I finally get > the validation errors I have to go back at the edit page and show the > selected date(and the error message) which should be 31 april 2008 but > the date is now 1st april 2008. > > Any suggestion? > > I know it should be better to have a calendar instead of a date_select > but I can''t. > -- > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Let me clarify. The date_select help generates 3 combobox, days, months and year. So for a user it is possible the select in days 31 for april, I know its a wrong date that''s why I want to nofify the user that he entered a wrong, but when I display the page back whit the error the date has changed to may 1st. I would like to show him the date_select with 31 april 2008 with the error on the site "Wrong date!" So we that behavior, which is better to a crash(like it was before), I can''t display back the date entered by the user. Remi Rick wrote:> I''m not sure about that "should be 31 April" since every April I''ve > ever experienced has only had 30 days. Your first statement "it > converts it for 1st may" actually seems to be correct behavior if > you''re riding on time''s arrow. > > Rick > > > On Oct 31, 5:44�am, R�mi Gagnon <rails-mailing-l...@andreas-s.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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Remi, Sorry it''s taken me so long to get back to you, I lost the thread... I think what you''re looking for is the callback from ActiveRecord::Callbacks -- before_save Rick On Nov 1, 4:31 am, Rémi Gagnon <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Let me clarify. > > The date_select help generates 3 combobox, days, months and year. So > for a user it is possible the select in days 31 for april, I know its a > wrong date that''s why I want to nofify the user that he entered a wrong, > but when I display the page back whit the error the date has changed to > may 1st. I would like to show him the date_select with 31 april 2008 > with the error on the site "Wrong date!" > > So we that behavior, which is better to a crash(like it was before), I > can''t display back the date entered by the user. > > Remi > > Rick wrote: > > I''m not sure about that "should be 31 April" since every April I''ve > > ever experienced has only had 30 days. Your first statement "it > > converts it for 1st may" actually seems to be correct behavior if > > you''re riding on time''s arrow. > > > Rick > > > On Oct 31, 5:44 am, R mi Gagnon <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > -- > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---