title: Check how many times a row repeats in a table
body: <p>I have some records in a table, with the columns: <code>id, link, title</code>.</p>
  
  <p>Few rows in the db have the <code>link column</code> with the same value, and I want to know how for <code>link</code> how many rows have the same value.</p>
  
  <p>I have an idea on how to do it but I think there is a much easy solution.</p>
  
  <pre><code>o = Repo.select(:link).distinct
  o.each do |l|
    Repo.where(link: l.link).size
  end
  </code></pre>
  
  <p>Thank you.</p>