Skip to content

Commit 53c26fc

Browse files
author
Zachary Scott
committed
Remove docs regarding grouping multiple values, as we should avoid
duplicating API reference in guides. Also ✂️ [ci skip]
1 parent 22820f7 commit 53c26fc

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

guides/source/active_record_querying.md

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ To get the total of grouped items on a single query call `count` after the `grou
665665

666666
```ruby
667667
Order.group(:status).count
668-
# => { 'awaiting_approval' => 7, 'paid' => 12 }
668+
# => { 'awaiting_approval' => 7, 'paid' => 12 }
669669
```
670670

671671
The SQL that would be executed would be something like this:
@@ -676,23 +676,6 @@ FROM "orders"
676676
GROUP BY status
677677
```
678678

679-
It is possible to do this count with multiple values, to do this only add the
680-
other column to `group`.
681-
682-
```ruby
683-
Order.group(:status, :delivery_method).count
684-
# => { ['awaiting_approval', 'regular'] => 5, ['awaiting_approval', 'fast'] => 2, ['paid', 'regular'] => 2, ['paid', 'fast'] => 10 }
685-
```
686-
687-
The SQL that would be executed would be something like this:
688-
689-
```sql
690-
SELECT COUNT (*) AS count_all, status AS status,
691-
delivery_method AS delivery_method
692-
FROM "orders"
693-
GROUP BY status, delivery_method
694-
```
695-
696679
Having
697680
------
698681

0 commit comments

Comments
 (0)