title: How to make a "pivot table" on Ruby on Rails?
body: <p>First, I'd like to mention I'm COMPLETELY new to Ruby and Rails, I'm on my very first days of learning, so I apologize if I seem a bit unclear or too broad with my questions.</p>
  
  <p>I'm trying to do something simple (I think?), which is to pivot a table.</p>
  
  <p>I have a table that looks like this:</p>
  
  <pre><code>----------------------------------
  | Name     | Product ID | Amount |
  |----------|----------------------
  | Robert   |     P1     |   2    |
  | Michael  |     P2     |   1    |
  | Leonard  |     P2     |   1    |
  | Robert   |     P2     |   4    |
  | Robert   |     P3     |   2    |
  | Michael  |     P3     |   1    |
  ----------------------------------
  </code></pre>
  
  <p>... and I'd like to to turn it into something like this:</p>
  
  <pre><code>---------------------------
  | Name     | P1 | P2 | P3 |
  ---------------------------
  | Robert   | 2  | 4  | 2  |
  | Michael  | -  | 1  | 1  |
  | Leonard  | -  | 1  | -  |
  ---------------------------
  </code></pre>
  
  <p>I'm not too sure how to achieve that. I've looked around and haven't found anything specific to my question.</p>
  
  <p>I found a gem called pivot_table, which can be found here: <a href="https://github.com/edjames/pivot_table" rel="noreferrer">https://github.com/edjames/pivot_table</a> but I have no clue how to <em>exactly</em> use it. It has a small guide in it, but I don't know where to place the code.</p>
  
  <p>Any help is greatly appreciated.</p>
  
  <p>Thank you.</p>