title: Ruby on Rails - How to know how many time the same Object appears in Array using Active Record?
body: <p>How to know how many times the same Object appears in Array?
  I want to check how many times I found the object, like:</p>
  
  <pre><code>array = ['A','A','A','B','B','C','C','C','D']
  </code></pre>
  
  <p>So, A appeared three times, B twice, C three too, and only one for D. </p>
  
  <p>I know that if I use "find_all", like: </p>
  
  <pre><code>array.find_all{ |e| array.count(e) &gt; 1 }
  </code></pre>
  
  <p>I will get with answer </p>
  
  <pre><code>["A", "A", "A", "B", "B", "C", "C", "C"]
  </code></pre>
  
  <p>but, how I can count this? I want something like:</p>
  
  <pre><code> A = 3, B = 2, C = 3, D = 1.
  </code></pre>