Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

[PATCH][3.0] join doesn't work properly for association with :through

#3846

When you define an association like the following ...

class Author
   has_many :author
end
class Post
   belongs_to :author
end
class Comment
   belongs_to :post
   has_one :post_author, :through=>:post, :source=>:author
end

Then if you write the code like the following ...

comments = Comment.find :all, :conditions=>["authors.name = ?", "David"], :joins=>[:post_author]

You get a wrong SQL and result as you can see the test which is included in first commit of a patch uploading. The second commit of the patch fixes the issue.

This is a same issue as the following.
https://rails.lighthouseapp.com/projects/8994/tickets/3684-invalid-...

Since the patch is made against Rails 3 here, I create a new ticket.

Reported by Tatsuya Ono · February 4th, 2010 @ 01:47 AM

State: stale
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. Rohit Arondekar
    Rohit Arondekar
    • State changed from new to stale
    • Importance changed from to Low

    Marking ticket as stale. If this is still an issue please leave a comment with suggested changes, creating a patch with tests, rebasing an existing patch or just confirming the issue on a latest release or master/branches.

    October 9th, 2010 @ 03:10 AM