1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Use #distinct instead of #uniq in the guides [ci skip] (#25098)

* #uniq will be deprecated, see: rails/rails@adfab2d
This commit is contained in:
Junya Ogura 2016-05-21 23:06:34 +09:00 committed by Rafael França
parent e530534265
commit 3c557cb333

View file

@ -1121,7 +1121,7 @@ If you want to select a set of records whether or not they have associated
records you can use the `left_outer_joins` method.
```ruby
Author.left_outer_joins(:posts).uniq.select('authors.*, COUNT(posts.*) AS posts_count').group('authors.id')
Author.left_outer_joins(:posts).distinct.select('authors.*, COUNT(posts.*) AS posts_count').group('authors.id')
```
Which produces: