Permalink
Browse files

[ci skip] add API doc for AR Group.

  • Loading branch information...
1 parent 5b36801 commit ae1b42c339a80794fb6f641e9a290dbfff72138e @aditya-kapoor aditya-kapoor committed Jun 16, 2014
Showing with 9 additions and 1 deletion.
  1. +9 −1 activerecord/lib/active_record/relation/calculations.rb
@@ -19,7 +19,15 @@ module Calculations
#
# Person.group(:city).count
# # => { 'Rome' => 5, 'Paris' => 3 }
- #
+ #
+ # If +count+ is used with +group+ for multiple columns, it returns a Hash whose
+ # keys are an array containing the individual values of each column and the value
+ # of each key would be the +count+.
+ #
+ # Article.group(:status, :category).count
+ # # => {["draft", "business"]=>10, ["draft", "technology"]=>4,
+ # ["published", "business"]=>0, ["published", "technology"]=>2}
+ #
# If +count+ is used with +select+, it will count the selected columns:
#
# Person.select(:age).count

0 comments on commit ae1b42c

Please sign in to comment.