-
Using .inject to Find the Most Popular Item in a Has_Many, Through Relationship
What is the most common item in your database? This post outlines working with has_many, through relationships in Ruby and how to query and sort the data to get the most popular item.