Have you tried my dm-trimmer plugin? Http://github.com/harukizaemon/dm-trimmer

On Oct 13, 6:20 am, Tony Mann <[email protected]> wrote:
> I could not find an existing bug report filed, so I submitted a
> ticket<http://datamapper.lighthouseapp.com/projects/20609-datamapper/tickets...>
> with
> the proposed fix.
> ..tony..
>
>
>
> On Mon, Oct 12, 2009 at 12:10 PM, Tony Mann <[email protected]> wrote:
> > I came up with what seems like a decent fix. In Datamapper::Property I
> > added these lines at the head of typecast_to_numeric:
> > def typecast_to_numeric(value, method)
> >       if value.is_a?(String) && value.strip.empty?
> >         nil
> >       elsif...
>
> > If this seems like a reasonable approach, I can submit a bug and patch (or
> > perhaps a bug is filed already).
>
> > ..tony..
>
> > On Mon, Oct 12, 2009 at 11:53 AM, Tony Mann <[email protected]> wrote:
>
> >> In DM 0.10.1, if you pass a blank string into an Integer property, you get
> >> the following exception when using MySQL:
>
> >> DataObjects::SQLError: Incorrect integer value: '' for column 'num' at row
> >> 1
>
> >> Here is the code that shows the issue:
>
> >>http://gist.github.com/208625
> >> The causes major problems when submitting forms in Merb, since blank
> >> fields are passed as in as blank string parameter values, and these
> >> parameter values are generally passed right into a Resource#update call.
> >> This problem did not occur in 0.9.
>
> >> I looked at the DM code, but I could not find an obvious place to add code
> >> to massage the blank strings to nils. Any suggestions?
>
> >> ..tony..
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to