#1239 confirmed

Deep nested resources use the wrong id.

Reported by michaelxavier | April 10th, 2010 @ 07:57 PM


I'm using edge datamapper. Greatgrandchild.find(:user => @user) applies the WHERE 'id' = 1 to the Greatgrandchild rather than the User. Thanks to namelessjon for helping me find this.

Comments and changes to this ticket

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) April 11th, 2010 @ 12:44 AM

    • State changed from “new” to “confirmed”

    I can confirm this is a problem after running the script locally.

    I modified it slightly so that the last line of ruby code is:

    p Greatgrandchild.all(:grandchild => { :child => { :user => @user } })

    .. and I believe I got the correct results.

    Now all we have to do is make it so that when you specify :user => @user as the original code did, it unrolls that to become :grandchild => { :child => { :user => @user } } underneath. Off the top of my head I'm not sure how to do that, but I don't think it will be too difficult, and I would bet that DataMapper::Associations::ManyToMany::Relationship#source_scope is the place where I would start looking.

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