This project is archived and is in readonly mode.
[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
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.
Comments and changes to this ticket
-
Rohit Arondekar October 9th, 2010 @ 03:10 AM
- 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.
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="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>