I have associated two models Businesses
and Ratings
. A business can be rated many times, and each rating stores an integer from 0 to 5.
I would like to create a "Hall of Fame" page, where I list the top 10 businesses, by sorting businesses based on average ratings (which would use the Ratings
model) and limiting the results to 10.
I'm not sure how to write hall_of_fame method for the controller, or would I also need a helper for this?