This is an age-old question where given a table with attributes \'type\', \'variety\' and \'price\', that you fetch the record with the minimum price for each type there is.
To update Avdi's answer above:
Table.minimum(:price, :group => :type)
Here is the updated URL:
http://api.rubyonrails.org/classes/ActiveRecord/Calculations.html#method-i-minimum