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:
parent
e530534265
commit
3c557cb333
1 changed files with 1 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue