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

[ci skip] add API doc for AR Group.

This commit is contained in:
Aditya Kapoor 2014-06-17 01:20:36 +05:30
parent 5b368010f6
commit ae1b42c339

View file

@ -20,6 +20,14 @@ module ActiveRecord
# 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