title: translate sql query to activerecord
body: <p>I have a line of code looking like this</p>
  
  <pre><code>    @words =  Word.connection.select_all("select text, count(*) as occurs from words join works on words.work_id = works.id where works.grouping == 'group1' group by text order by occurs desc limit 10")
  </code></pre>
  
  <p>I would like to write it in a more rails/active record way but the syntax is still quite new to me.</p>
  
  <p>each work has many words, each word belongs to one work.</p>