I already have a working solution, but I would really like to know why this doesn\'t work:
ratings = Model.select(:rating).uniq ratings.each { |r| puts r.rat
You can use the following Gem: active_record_distinct_on
Model.distinct_on(:rating)
Yields the following query:
SELECT DISTINCT ON ( "models"."rating" ) "models".* FROM "models"