
DataMapper throw exception when bad formatted date hash is passed
Reported by currep | December 3rd, 2009 @ 03:31 PM
When a "blank" string is passed in a date has @person.birthdate = {:month => 12, :day => 3, :year => ""} like when being posted form a Form and a field is left blank, datamapper throw an exception. See pastie: http://pastie.org/726374
There is a 'proposed' fix in the pastie, but it makes the assumption that "" should evaluate to 0. (maybe?) Dkubb said the value should just be passed on so validators can handle it.
Comments and changes to this ticket
-
currep December 3rd, 2009 @ 04:38 PM
These methods http://pastie.org/726519 throw exceptions if garbage data gets into the #new method. They shoudl probably catch exceptions and return 'nil' or the original value.
-
currep December 3rd, 2009 @ 09:45 PM
Here is a sample script with it working with the rescue Exceptions: http://pastie.org/726902
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
People watching this ticket
Referenced by
-
1145 Coercion problem with a missing or blank Date part ediright beat me to it. This is a dupe of #1144