This project is archived and is in readonly mode.

#3846 ✓stale
Tatsuya Ono

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

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

When you define an association like the following ...

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

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

comments = Comment.find :all, :conditions=>[" = ?", "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.

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

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>