From bed98b9bf2023f75641fa79ffe7d95d70cf8b726 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Fri, 6 Aug 2010 13:33:02 +0200 Subject: [PATCH] AR guide: fixes a query --- railties/guides/source/active_record_querying.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/guides/source/active_record_querying.textile b/railties/guides/source/active_record_querying.textile index 5c4ed3a803..53095a2bd3 100644 --- a/railties/guides/source/active_record_querying.textile +++ b/railties/guides/source/active_record_querying.textile @@ -764,7 +764,7 @@ This loads all the posts and the associated category and comments for each post. h5. Nested Associations Hash -Category.find(1).includes(:posts => [{:comments => :guest}, :tags]) +Category.includes(:posts => [{:comments => :guest}, :tags]).find(1) 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.