diff options
author | Aditya Kapoor <aditya.kapoor@vinsol.com> | 2014-06-17 01:20:36 +0530 |
---|---|---|
committer | Aditya Kapoor <aditya.kapoor@vinsol.com> | 2014-06-17 01:20:36 +0530 |
commit | ae1b42c339a80794fb6f641e9a290dbfff72138e (patch) | |
tree | 84aa69712eb0d121188da6e80a2a2d01e606e0f8 /activerecord | |
parent | 5b368010f64106f7b87a4306b41adcefa856ab67 (diff) | |
download | rails-ae1b42c339a80794fb6f641e9a290dbfff72138e.tar.gz rails-ae1b42c339a80794fb6f641e9a290dbfff72138e.tar.bz2 rails-ae1b42c339a80794fb6f641e9a290dbfff72138e.zip |
[ci skip] add API doc for AR Group.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/relation/calculations.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index 028e4d80ab..316a59e0bb 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -19,7 +19,15 @@ 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 |