diff options
author | Zachary Scott <e@zzak.io> | 2014-06-01 13:56:09 -0700 |
---|---|---|
committer | Zachary Scott <e@zzak.io> | 2014-06-01 13:56:09 -0700 |
commit | 53c26fcaee58e15eb4f11ce250c09a3015e0e1a1 (patch) | |
tree | 7348ef7a0f9ef952d57e6f18a5a7d3b27d6aaf8f | |
parent | 22820f7bbe6dbd897a78ca281e41448d4e582cea (diff) | |
download | rails-53c26fcaee58e15eb4f11ce250c09a3015e0e1a1.tar.gz rails-53c26fcaee58e15eb4f11ce250c09a3015e0e1a1.tar.bz2 rails-53c26fcaee58e15eb4f11ce250c09a3015e0e1a1.zip |
Remove docs regarding grouping multiple values, as we should avoid
duplicating API reference in guides. Also :scissors: [ci skip]
-rw-r--r-- | guides/source/active_record_querying.md | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md index b2d71d4be8..673dcfc1d3 100644 --- a/guides/source/active_record_querying.md +++ b/guides/source/active_record_querying.md @@ -665,7 +665,7 @@ To get the total of grouped items on a single query call `count` after the `grou ```ruby Order.group(:status).count -# => { 'awaiting_approval' => 7, 'paid' => 12 } +# => { 'awaiting_approval' => 7, 'paid' => 12 } ``` The SQL that would be executed would be something like this: @@ -676,23 +676,6 @@ FROM "orders" GROUP BY status ``` -It is possible to do this count with multiple values, to do this only add the -other column to `group`. - -```ruby -Order.group(:status, :delivery_method).count -# => { ['awaiting_approval', 'regular'] => 5, ['awaiting_approval', 'fast'] => 2, ['paid', 'regular'] => 2, ['paid', 'fast'] => 10 } -``` - -The SQL that would be executed would be something like this: - -```sql -SELECT COUNT (*) AS count_all, status AS status, -delivery_method AS delivery_method -FROM "orders" -GROUP BY status, delivery_method -``` - Having ------ |