From 5a44951186b410c3a79685f8aeaa926d93a6aab0 Mon Sep 17 00:00:00 2001
From: Ryan Bigg <radarlistener@gmail.com>
Date: Tue, 22 Mar 2011 12:16:15 +1100
Subject: Querying guide: mention that performing a where on an relation that
 contains an includes statement will generate a LEFT OUTER JOIN rather than an
 INNER JOIN or another query

---
 railties/guides/source/active_record_querying.textile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'railties/guides/source/active_record_querying.textile')

diff --git a/railties/guides/source/active_record_querying.textile b/railties/guides/source/active_record_querying.textile
index e0fab46db9..009d541106 100644
--- a/railties/guides/source/active_record_querying.textile
+++ b/railties/guides/source/active_record_querying.textile
@@ -759,7 +759,9 @@ This would generate a query which contains a +LEFT OUTER JOIN+ whereas the +join
   SELECT "posts"."id" AS t0_r0, ... "comments"."updated_at" AS t1_r5 FROM "posts" LEFT OUTER JOIN "comments" ON "comments"."post_id" = "posts"."id" WHERE (comments.visible)
 </ruby>
 
-If in this case there were no comments for any posts, all the posts would still be loaded. By using +joins+ (an INNER JOIN), the join conditions *must* match, otherwise no records will be returned.
+If there was no +where+ condition, this would generate the normal set of two queries.
+
+If, in the case of this +includes+ query, there were no comments for any posts, all the posts would still be loaded. By using +joins+ (an INNER JOIN), the join conditions *must* match, otherwise no records will be returned.
 
 h3. Scopes
 
-- 
cgit v1.2.3

