#1051 ✓resolved
Roy Wright

should allow to call #destroy on an intermediate resource

Reported by Roy Wright | September 20th, 2009 @ 01:07 AM | in 0.10.2

destroy called on a Resource join table for an n:n association does not remove the record from the join table. This problem is introduced by dm-core-0.10.0 (no problem with the later 0.9.x series).

Attached the spec showing the problem that #snusnu created from my problem description on IRC: http://pastie.org/623080

Comments and changes to this ticket

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) September 20th, 2009 @ 10:50 PM

    • State changed from “new” to “not-applicable”

    At the beginning of your failing spec, if you check the number of AgentJob instances, you'll see it's 2.

    What's happening is that the before :each call executes once for each "it" block, but the resources aren't cleared out between runs. When the resources are cleared out the specs will pass.

  • Roy Wright

    Roy Wright September 21st, 2009 @ 01:14 AM

    Thank you.

    After correcting the spec per your instructions, I then further isolated the problem. Basically after dereferencing an association, you can not save the primary model unless you reload the association.

    I.e., the following fails:

    intermediate = @job.agent_jobs.first

    while the rest do not fail:

    intermediate = @job.agent_jobs.first
    @job.agents.reload @job.save

    intermediate = @job.agent_jobs.first

    intermediate = @job.agent_jobs.first
    @agent.jobs.reload @agent.save

    Uploaded new spec showing the failure and non-failure cases.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) October 7th, 2009 @ 12:09 PM

    • Milestone set to 0.10.2
    • State changed from “not-applicable” to “resolved”
    • Assigned user set to “Dan Kubb (dkubb)”

    This should now be resolved with 1209a97dc846a361005b82f15928010fec1bcac1 in dm-more/master

    Can you install edge dm-core and verify it is resolved on your end?

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