mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
AR guide: fixes a query
This commit is contained in:
@@ -764,7 +764,7 @@ This loads all the posts and the associated category and comments for each post.
|
||||
h5. Nested Associations Hash
|
||||
|
||||
<ruby>
|
||||
Category.find(1).includes(:posts => [{:comments => :guest}, :tags])
|
||||
Category.includes(:posts => [{:comments => :guest}, :tags]).find(1)
|
||||
</ruby>
|
||||
|
||||
This will find the category with id 1 and eager load all of the associated posts, the associated posts' tags and comments, and every comment's guest association.
|
||||
|
||||
Reference in New Issue
Block a user