title: Order records in table by other table column
body: <p>I have 3 tables: <code>articles</code>, <code>people</code> and <code>person_mentions</code>.</p>
  
  <p><code>Article</code> model <code>has_many :people, through: person_mentions</code> and so on.</p>
  
  <p>In <code>person_mentions</code> table I have 3 columns <code>article_id</code>, <code>person_id</code> and <code>mention_order</code>. <code>mention_order</code> is an integer.</p>
  
  <p>I need to find all people, who mentioned in article and order them by <code>mention_order</code>, but when I run</p>
  
  <pre><code>@article.people.order(mention_order: :asc)
  </code></pre>
  
  <p>I get an error</p>
  
  <blockquote>
    <p>column people.mention_order does not exist</p>
  </blockquote>
  
  <p>So, I need to make a query from <code>people</code> table with <code>mention_order</code> from <code>person_mentions</code> in it.</p>
  
  <p>Thanks for any help!</p>