title: How to list top 10 school with active record - rails
body: <p>I have two models: <code>School</code> and <code>Review</code>.</p>
  
  <p>The <code>School</code> model looks like this: <code>{ID, name, city, state}</code> </p>
  
  <p>The <code>Review</code> model looks like this: <code>{ID, content, score, school_id}</code></p>
  
  <p>How do I list the top ten schools based on the score from the review model?</p>
  
  <p>I thought maybe a method in the school-model, with something like this:</p>
  
  <pre><code>class School &lt; ActiveRecord::Base
   def top_schools
     @top_schools = School.limit(10)
     ...
   end
  end
  </code></pre>
  
  <p>And then loop them in a <code>&lt;li&gt;</code> list:</p>
  
  <pre><code>&lt;div&gt;
   &lt;ul&gt;
     &lt;% @top_schools.each do |school| %&gt;
        &lt;li&gt;school.name&lt;/li&gt;
     &lt;%end&gt;
   &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>But, I dont really know how to finish the <code>top_schools</code> method.</p>