title: Ordering by a two fields, one being created_at, In Rails
body: <p>This is a follow-up question to <a href="https://stackoverflow.com/questions/8703892/custom-efficient-complex-ordering-in-rails-3/8715275#8715275">Custom, Efficient, Complex Ordering in Rails 3</a></p>
  
  <p>I'd like to develop an efficient ordering method for a rails model I have. Suppose that I save a rating for all objects in a field named "popularity". If I wanted to sort by this rating I would do:</p>
  
  <pre><code>  Model.order('popularity ASC')
  </code></pre>
  
  <p>How would I order by a skew for created at? Is there a way to, perhaps, convert the creation timestamp to an integer value, and then sort by popularity - created_at such that older objects' ratings decrease over time? IE something like:</p>
  
  <pre><code>  Model.order('popularity-integerize(created_at) ASC')
  </code></pre>
  
  <p>So: how might I do this, and is it efficient?</p>