aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZachary Scott <mail@zzak.io>2015-10-29 21:47:24 +0900
committerZachary Scott <mail@zzak.io>2015-10-29 21:47:24 +0900
commit8732b8b3017a81f381a7d43509f92f6990a7893c (patch)
tree30b2a31d8759da6d013ec32531f971b49c617cc9
parent0fb2d1a0ba3360e928a7ac9d20378d7f5fbf915f (diff)
parente1ca69713c8d59e7e3378ad47954fe6a6052b1d4 (diff)
downloadrails-8732b8b3017a81f381a7d43509f92f6990a7893c.tar.gz
rails-8732b8b3017a81f381a7d43509f92f6990a7893c.tar.bz2
rails-8732b8b3017a81f381a7d43509f92f6990a7893c.zip
Merge pull request #22114 from oesgalha/docs_use_distinct
Use #distinct instead of #uniq in the guides
-rw-r--r--guides/source/active_record_querying.md4
-rw-r--r--guides/source/association_basics.md6
2 files changed, 5 insertions, 5 deletions
diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md
index 8ea0f383c0..1427903dfb 100644
--- a/guides/source/active_record_querying.md
+++ b/guides/source/active_record_querying.md
@@ -80,7 +80,7 @@ The methods are:
* `reorder`
* `reverse_order`
* `select`
-* `uniq`
+* `distinct`
* `where`
All of the above methods return an instance of `ActiveRecord::Relation`.
@@ -999,7 +999,7 @@ SELECT categories.* FROM categories
INNER JOIN articles ON articles.category_id = categories.id
```
-Or, in English: "return a Category object for all categories with articles". Note that you will see duplicate categories if more than one article has the same category. If you want unique categories, you can use `Category.joins(:articles).uniq`.
+Or, in English: "return a Category object for all categories with articles". Note that you will see duplicate categories if more than one article has the same category. If you want unique categories, you can use `Category.joins(:articles).distinct`.
#### Joining Multiple Associations
diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md
index 999c533fb3..74cd9bdc7b 100644
--- a/guides/source/association_basics.md
+++ b/guides/source/association_basics.md
@@ -2163,7 +2163,7 @@ You can use any of the standard [querying methods](active_record_querying.html)
* `order`
* `readonly`
* `select`
-* `uniq`
+* `distinct`
##### `where`
@@ -2239,9 +2239,9 @@ If you use the `readonly` method, then the associated objects will be read-only
The `select` method lets you override the SQL `SELECT` clause that is used to retrieve data about the associated objects. By default, Rails retrieves all columns.
-##### `uniq`
+##### `distinct`
-Use the `uniq` method to remove duplicates from the collection.
+Use the `distinct` method to remove duplicates from the collection.
#### When are Objects Saved?