#400 ✓resolved
Dirkjan Bussink

A validation on a foreign key fails if the association gets set

Reported by Dirkjan Bussink | June 18th, 2008 @ 02:54 PM

The spec shows the problem quite clear i think :).

Comments and changes to this ticket

  • Anthony Williams

    Anthony Williams June 18th, 2008 @ 03:53 PM


    Sounds very much like an issue I reported recently (#395). Assuming it's the same thing, Dan Kubb fixed it in dm-core edge; you might want to check that out and see if it works for you.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) June 18th, 2008 @ 07:28 PM

    • Assigned user changed from “Sam Smoot” to “Dan Kubb (dkubb)”
    • State changed from “new” to “open”
    • Milestone cleared.
  • Dirkjan Bussink

    Dirkjan Bussink June 19th, 2008 @ 01:36 AM

    Nope, i've checked with the fix Dan Kubb made and the issue is still there afaik. I did ask him about the same problem as in #395, which he happened to have just fixed by then :).

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) June 23rd, 2008 @ 06:40 PM

    • State changed from “open” to “invalid”

    I just applied the patch with this spec and it passed without any changes to dm-core or dm-validates.

    In dm-core there are already specs to ensure in many to one associations that the key is set immediately when the parent is assigned. While I very much appreciate you supplying specs that, no doubt, failed at one point, I won't be pushing them into git because they'd just be duplicates of what's already in dm-core.

    For now I'm going to close this ticket. If you sync up dm-core and dependent libraries to the latest in git and you can still reproduce this problem please reply with a failing spec and I'll check it out.

  • Sam Smoot

    Sam Smoot June 23rd, 2008 @ 06:47 PM

    BTW, what if the belongs-to side is a new_record? Might that make it fail since the key can't be set on assignment then? Is that scenario specced?

    Just curious if you know off the top of your head. Or something to consider for the other peeps watching the ticket if they want to confirm.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) June 23rd, 2008 @ 07:10 PM

    Sam, I don't believe that specific scenario is speced, although the association integration specs are so large and disorganized that its difficult to know precisely what it specs.

    To help alleviate this problem I'm organizing any new specs I write in separate integration specs for each type of association, and using the same style of specs I used for Collection, for example:


  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) June 23rd, 2008 @ 07:23 PM

    • State changed from “invalid” to “resolved”

    Since this was a valid bug at one time I've marked it as resolved instead of invalid.

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 »


Referenced by