Skip to content

Commit

Permalink
Use #distinct instead of #uniq in the guides [ci skip]
Browse files Browse the repository at this point in the history
* #uniq is an alias of #distinct
* #uniq will be deprecated, see: adfab2d
  • Loading branch information
oesgalha committed Oct 29, 2015
1 parent 0fb2d1a commit e1ca697
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions guides/source/active_record_querying.md
Expand Up @@ -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`.
Expand Down Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions guides/source/association_basics.md
Expand Up @@ -2163,7 +2163,7 @@ You can use any of the standard [querying methods](active_record_querying.html)
* `order`
* `readonly`
* `select`
* `uniq`
* `distinct`

##### `where`

Expand Down Expand Up @@ -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?

Expand Down

0 comments on commit e1ca697

Please sign in to comment.