title: group by column and select other column as list in rails
body: <p>I have a table like bellow</p>
  
  <pre><code>+---+---+
  | A | B |
  +---+---+
  | 1 | 1 |
  +---+---+
  | 2 | 1 |
  +---+---+
  | 3 | 2 |
  +---+---+
  | 4 | 2 |
  +---+---+
  | 5 | 2 |
  +---+---+
  </code></pre>
  
  <p>Is there an effective way to query to form like:</p>
  
  <pre><code>{1 =&gt; [1,2], 2 =&gt; [3,4,5]}
  </code></pre>
  
  <p>(group by B and select A as list)</p>