diff options
author | capps <capps@madcapps.com> | 2013-03-11 08:10:43 -0700 |
---|---|---|
committer | capps <capps@madcapps.com> | 2013-03-11 08:10:43 -0700 |
commit | d5c7257e75ba0d0fdd356fdb12e4be18e4701a30 (patch) | |
tree | da624020e2479e56d693819460cddb8ad09260a7 /guides/source | |
parent | b938f08a3352981f9a2876a60ff2600438b771c2 (diff) | |
download | rails-d5c7257e75ba0d0fdd356fdb12e4be18e4701a30.tar.gz rails-d5c7257e75ba0d0fdd356fdb12e4be18e4701a30.tar.bz2 rails-d5c7257e75ba0d0fdd356fdb12e4be18e4701a30.zip |
I think "uniq" is more Rails-y than select("distinct(categories.id)")
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/active_record_querying.md | 2 |
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 |