Permalink
Browse files

fix example query

  • Loading branch information...
1 parent c327ef4 commit e836fc1bd2f3df0b8b0a2ef5deb182bcf1f0f3c2 @vijaydev vijaydev committed Apr 6, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 railties/guides/source/active_record_querying.textile
@@ -790,7 +790,7 @@ Post.includes(:comments).where("comments.visible", true)
This would generate a query which contains a +LEFT OUTER JOIN+ whereas the +joins+ method would generate one using the +INNER JOIN+ function instead.
<ruby>
- 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)
+ 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 = 1)
</ruby>
If there was no +where+ condition, this would generate the normal set of two queries.

0 comments on commit e836fc1

Please sign in to comment.