Thijs Cadier
2006-Jul-13 13:33 UTC
date_helper megapatch and MultiparameterAssignmentErrors
Hello all, There''s a great patch in trac that fixes a lof of issues with the date helpers. I''m afraid it hasn''t had any attention yet. http://dev.rubyonrails.org/ticket/3811 This fixes all the little date_helper problems, except one: When you choose an invalid date ActiveRecord throws an ActiveRecord::MultiparameterAssignmentErrors. This used to work in 1.0, Februari 30th would be translated to March 2nd. I have no clue on how this could be fixed since the Error is thrown deep inside. I was going to create a ticket for this, but Trac isn''t working to well at the moment. It would be great if the date_helpers could get some love, they''re basically broken and useless in the current state. Is there any core member out there who could take a look at this? Thanks, Thijs Cadier
Thijs Cadier
2006-Jul-13 14:02 UTC
Re: date_helper megapatch and MultiparameterAssignmentErrors
Hello, I''m sorry but it seems that I made a mistake. This patch fixes the ActiveRecord::MultiparameterAssignmentErrors issue to. My mistake, but it''s yet another reason to apply the patch :-). Thanks, Thijs Cadier On 13-jul-2006, at 15:33, Thijs Cadier wrote:> Hello all, > > There''s a great patch in trac that fixes a lof of issues with the > date helpers. I''m afraid it hasn''t had any attention yet. > > http://dev.rubyonrails.org/ticket/3811 > > This fixes all the little date_helper problems, except one: When > you choose an invalid date ActiveRecord throws an > ActiveRecord::MultiparameterAssignmentErrors. This used to work in > 1.0, Februari 30th would be translated to March 2nd. I have no clue > on how this could be fixed since the Error is thrown deep inside. I > was going to create a ticket for this, but Trac isn''t working to > well at the moment. > > It would be great if the date_helpers could get some love, they''re > basically broken and useless in the current state. Is there any > core member out there who could take a look at this? > > > Thanks, > > Thijs Cadier > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core-- Thijs Cadier / 80beans Oosterdokskade 5 1011 AD Amsterdam Postbus 10212 1001 EE Amsterdam T: +31 (0)20 4284106 F: +31 (0)20 4284107 M: +31 (0)6 24869497 E: thijs@80beans.com W: www.80beans.com
Bob Silva
2006-Jul-14 00:46 UTC
RE: date_helper megapatch andMultiparameterAssignmentErrors
Even though I wrote it, this patch actually shouldn''t be applied. Date helper should definately be refactored, but the smaller fixes should go in first. There are nasty bugs in the patch logic that surface on some edge cases (I don''t remember what they are now). I did up an article on one way to handle the bad date exceptions here. http://i.nfectio.us/articles/2006/02/22/handling-invalid-dates-with-activere cord-date-helpers I work with a lot of dates in my applications and I moved completely away from Rails dates in favor of JS-based calendars, hidden fields and strftime after futzing with Rails dates for awhile. I would suggest core mark the patch wontfix with a PDI on breaking it up into smaller fixes. Then plan a refactored version for 2.0. Bob Silva http://i.nfectio.us/> -----Original Message----- > From: rails-core-bounces@lists.rubyonrails.org [mailto:rails-core- > bounces@lists.rubyonrails.org] On Behalf Of Thijs Cadier > Sent: Thursday, July 13, 2006 6:33 AM > To: rails-core@lists.rubyonrails.org > Subject: [Rails-core] date_helper megapatch > andMultiparameterAssignmentErrors > > Hello all, > > There''s a great patch in trac that fixes a lof of issues with the > date helpers. I''m afraid it hasn''t had any attention yet. > > http://dev.rubyonrails.org/ticket/3811 > > This fixes all the little date_helper problems, except one: When you > choose an invalid date ActiveRecord throws an > ActiveRecord::MultiparameterAssignmentErrors. This used to work in > 1.0, Februari 30th would be translated to March 2nd. I have no clue > on how this could be fixed since the Error is thrown deep inside. I > was going to create a ticket for this, but Trac isn''t working to well > at the moment. > > It would be great if the date_helpers could get some love, they''re > basically broken and useless in the current state. Is there any core > member out there who could take a look at this? > > > Thanks, > > Thijs Cadier > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core
Jonathan Viney
2006-Jul-14 01:21 UTC
Re: date_helper megapatch andMultiparameterAssignmentErrors
I have actually just modified my validates_date_time plugin to workaround the MultiparameterAssignmentErrors problem that occurs when the user selects an invalid date. I simply store the input as a string (eg: 2006-02-30) rather than a Date object, then the validation of validates_date will see the date string as invalid and add an error to the model object. It''s a hack, but it works. The date handling in Rails definitely needs some work. -Jonathan. On 7/14/06, Bob Silva <me@bobsilva.com> wrote:> Even though I wrote it, this patch actually shouldn''t be applied. > Date helper should definately be refactored, but the smaller fixes should go > in first. There are nasty bugs in the patch logic that surface on some edge > cases (I don''t remember what they are now). > > I did up an article on one way to handle the bad date exceptions here. > > http://i.nfectio.us/articles/2006/02/22/handling-invalid-dates-with-activere > cord-date-helpers > > I work with a lot of dates in my applications and I moved completely away > from Rails dates in favor of JS-based calendars, hidden fields and strftime > after futzing with Rails dates for awhile. > > I would suggest core mark the patch wontfix with a PDI on breaking it up > into smaller fixes. Then plan a refactored version for 2.0. > > Bob Silva > http://i.nfectio.us/ > > > > -----Original Message----- > > From: rails-core-bounces@lists.rubyonrails.org [mailto:rails-core- > > bounces@lists.rubyonrails.org] On Behalf Of Thijs Cadier > > Sent: Thursday, July 13, 2006 6:33 AM > > To: rails-core@lists.rubyonrails.org > > Subject: [Rails-core] date_helper megapatch > > andMultiparameterAssignmentErrors > > > > Hello all, > > > > There''s a great patch in trac that fixes a lof of issues with the > > date helpers. I''m afraid it hasn''t had any attention yet. > > > > http://dev.rubyonrails.org/ticket/3811 > > > > This fixes all the little date_helper problems, except one: When you > > choose an invalid date ActiveRecord throws an > > ActiveRecord::MultiparameterAssignmentErrors. This used to work in > > 1.0, Februari 30th would be translated to March 2nd. I have no clue > > on how this could be fixed since the Error is thrown deep inside. I > > was going to create a ticket for this, but Trac isn''t working to well > > at the moment. > > > > It would be great if the date_helpers could get some love, they''re > > basically broken and useless in the current state. Is there any core > > member out there who could take a look at this? > > > > > > Thanks, > > > > Thijs Cadier > > _______________________________________________ > > Rails-core mailing list > > Rails-core@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-core > > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core >