title: How to find the record with the maximum price?
body: <p>This returns the maxium <em>value</em>, not the complete record:</p>
  <pre><code>self.prices.maximum(:price_field)
  </code></pre>
  <p>And currently, I find the record like this:</p>
  <pre><code>def maximum_price
    self.prices.find(:first, :conditions =&gt; &quot;price = #{self.prices.maximum(:price_field)}&quot; )
  end
  </code></pre>
  <p>Is this the correct way ? Because the above needs two SQL statements to make it work, and it somehow does not feel right.</p>
  <p><strong>Ps.</strong> Additionally, I want that if more than one record has the same &quot;maximum&quot; value, then it should get the one with the latest <code>updated_at</code> value. So that would mean another SQL statement??</p>
  <p><strong>Pps.</strong> Does anyone know of a <em>good</em> or <em>detailed</em> reference for AREL and non-AREL things in Rails? The Rails Guide for ActiveRecord query is just not enough!</p>
  <p>(I'm using Rails 3)</p>
  <h3>===UPDATE===</h3>
  <p>Using AREL I do the following:</p>
  <pre><code>self.prices.order(&quot;updated_at DESC&quot;).maximum(:price_field)
  </code></pre>
  <p>But this only gives the maximum <em>value</em>, not the complete record :(<br>
  Also, is the use of <code>maximum()</code> really AREL?</p>