aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides
diff options
context:
space:
mode:
authorRyan Bigg <radarlistener@gmail.com>2011-03-22 12:16:15 +1100
committerRyan Bigg <radarlistener@gmail.com>2011-03-22 12:16:15 +1100
commit5a44951186b410c3a79685f8aeaa926d93a6aab0 (patch)
treebe5394145590a884c690c064518b02372b328a83 /railties/guides
parentc24e5548fd372e4d0058ab417230ebc2fa3bebde (diff)
downloadrails-5a44951186b410c3a79685f8aeaa926d93a6aab0.tar.gz
rails-5a44951186b410c3a79685f8aeaa926d93a6aab0.tar.bz2
rails-5a44951186b410c3a79685f8aeaa926d93a6aab0.zip
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
Diffstat (limited to 'railties/guides')
-rw-r--r--railties/guides/source/active_record_querying.textile4
1 files changed, 3 insertions, 1 deletions
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