title: Ruby on Rails: getting the max value from a DB column
body: <p>Currently I can make the straight-up SQL query on my DB:</p>
  
  <pre class="lang-sql prettyprint-override"><code>SELECT MAX(bar) FROM table_name
  </code></pre>
  
  <p>And it returns with the max value in that table. When I make what I consider to be an equivalent call in Rails, however, it does not work. I am calling:</p>
  
  <pre class="lang-rb prettyprint-override"><code>Bar.all(:select =&gt; "Max(bar)")
  </code></pre>
  
  <p>This simply returns with:</p>
  
  <pre class="lang-rb prettyprint-override"><code>[#&lt;Bar &gt;]
  </code></pre>
  
  <p>In the column I'm calling on is a series of identifying numbers, I'm looking for the largest one. Is there some other way of accessing this in Rails?</p>