title: Define a custom ordering criteria in the relations() method
body: <p>I have a model <code>A</code> that has a relationship of type <code>HAS_MANY</code> with model <code>B</code>.</p>
  
  <p><code>B</code>'s attributes are:</p>
  
  <pre><code>id,
  user_id,
  message,
  date,
  parent_message_id
  </code></pre>
  
  <p>I need elements of model <code>B</code> to be ordered by date (descending), but in case the <code>parent_message_id</code> is different from null, the date to be taken into consideration should be the date corresponding to <code>parent_message_id</code>.</p>
  
  <p>Is it possible to customize the criteria used to order the relation?</p>