Currently I can make the straight-up SQL query on my DB:
SELECT MAX(bar) FROM table_name
And it returns
Assuming your model name is Bar and it has a column named bar, this should work:
Bar
bar
Bar.maximum("bar")
See the excellent Rails Guides section on Calculations for more info.
one more way
Bar.select("Max(bar) as max_bar").first.max_bar