title: RoR - counting unique values
body: <p>I'm a beginner at RoR and I am toying around with a database that has 6000 rows of data. Since there is so much data to begin with, I have the index table displaying only rows of data that have unique item names by using this in the controller/index view. </p>
  
  <pre><code>@glyphs_test = Glyph.group(:item)
  </code></pre>
  
  <p>Alongside each row, I want to display the number of times that particular item appears in the entire database.
  When I try this, it works but I don't know how to print it out onto the index. </p>
  
  <pre><code>Glyph.group(:item).uniq.count
  </code></pre>
  
  <p>results with, for example:</p>
  
  <pre><code>=&gt; {"Eternal Fire" =&gt; 8, "Glyph of Adrenaline Rush" =&gt; 74} etc...
  </code></pre>
  
  <p>Even if I was able to print out the number only in this, how can I match it up with the table? I think I am missing something crucial here. I am able to do this in the individual record by using this in the show#controller but not in index#controller.</p>
  
  <pre><code>@glyph = Glyph.find(params[:id])
  @glyphs = Glyph.where(["item = ?", @glyph.item]).order('net_gain ASC')
  </code></pre>
  
  <p>Thank you in advance for any advice. Perhaps I should do something more simpler but there must be a solution to this.</p>