title: Group by with ActiveRecord in Rails
body: <p>I have a the following table with rows:</p>
  
  <pre><code>===============================================
  id| name  | group1 | group2 | group3 | group4 |
  ===============================================
  1 | Bob   | 1      | 0      | 0      | 1      |
  ===============================================
  2 | Eric  | 0      | 1      | 0      | 1      |
  ===============================================
  3 | Muris | 1      | 0      | 1      | 1      |
  ===============================================
  4 | Angela| 0      | 0      | 0      | 1      |
  ===============================================
  </code></pre>
  
  <p><strong>EDIT:</strong>
  The expected result in my view would be as follow, it would output the group name(group1,group2... there is about 30 groups) and in parenthesis the count number of how many users have value 1 for that group.</p>
  
  <pre><code>group1 (2)
  group2 (1)
  group3 (1)
  group4 (4)
  </code></pre>
  
  <p>All help is appreciated.</p>