#651 ✓resolved
jack dempsey (jackdempsey)

weird cache like behavior related to typecasting

Reported by jack dempsey (jackdempsey) | November 11th, 2008 @ 04:15 PM


Strange behavior--dkubb has suggested it might be grabbing the object from the IdentityMap lookup (which may not be needed). Anyway, wanted to document this here.

Comments and changes to this ticket

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) November 30th, 2008 @ 12:27 PM

    • State changed from “new” to “open”

    I believe in this case Property#typecast has an incorrect approach to typecasting integers.

    For Integer properties should probably use a Regexp to ensure the String is "like a number", and then apply String#to_i on it, as I think most people would expect.

    I will make sure this is resolved in dkubb/dm-core.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) December 2nd, 2008 @ 12:52 AM

    Attached is a script that duplicates the code in the gist, but does not have the same problem with cached results being returned.

    However, it does show one of the original problems I found, which was that the Property#typecast method doesn't properly check the value to see if it remotely resembles a number. In this case it does not, so it shouldn't execute a query where the "is is NULL" at all. It should just return nil directly.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) December 2nd, 2008 @ 01:16 AM

    • State changed from “open” to “resolved”

    Just committed a fix to dkubb/dm-core that resolves this specific issue:


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.

New-ticket Create new ticket

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