Method: ActiveRecord::Calculations#maximum

Defined in:
lib/active_record/relation/calculations.rb

#maximum(column_name) ⇒ Object

Calculates the maximum value on a given column. The value is returned with the same data type of the column, or nil if there’s no row. See #calculate for examples with options.

Person.maximum(:age) # => 93


146
147
148
# File 'lib/active_record/relation/calculations.rb', line 146

def maximum(column_name)
  calculate(:maximum, column_name)
end