aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcapps <capps@madcapps.com>2013-03-11 08:10:43 -0700
committercapps <capps@madcapps.com>2013-03-11 08:10:43 -0700
commitd5c7257e75ba0d0fdd356fdb12e4be18e4701a30 (patch)
treeda624020e2479e56d693819460cddb8ad09260a7
parentb938f08a3352981f9a2876a60ff2600438b771c2 (diff)
downloadrails-d5c7257e75ba0d0fdd356fdb12e4be18e4701a30.tar.gz
rails-d5c7257e75ba0d0fdd356fdb12e4be18e4701a30.tar.bz2
rails-d5c7257e75ba0d0fdd356fdb12e4be18e4701a30.zip
I think "uniq" is more Rails-y than select("distinct(categories.id)")
-rw-r--r--guides/source/active_record_querying.md2
1 files changed, 1 insertions, 1 deletions
diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md
index 4a4f814917..e83c04d11e 100644
--- a/guides/source/active_record_querying.md
+++ b/guides/source/active_record_querying.md
@@ -970,7 +970,7 @@ SELECT categories.* FROM categories
INNER JOIN posts ON posts.category_id = categories.id
```
-Or, in English: "return a Category object for all categories with posts". Note that you will see duplicate categories if more than one post has the same category. If you want unique categories, you can use `Category.joins(:posts).select("distinct(categories.id)")`.
+Or, in English: "return a Category object for all categories with posts". Note that you will see duplicate categories if more than one post has the same category. If you want unique categories, you can use `Category.joins(:posts).uniq`.
#### Joining Multiple Associations