Topic: Any way to do a group by/sum call on ActiveRecord?
What I want to do is group by category and then sum of the aggregate values of the records in those categories...so if I had an Animal model with records of category Dog and Cat with weights...I want to find the total weight for both Cats and Dogs. I can think of a way to do it with custom sql or multiple queries, such as: a 'group by' to get an array of the different categories, and then a do loop that does something like Animal.sum("weight", :conditions=>{"category=?", animaltype}). But I was wondering if there was a more elegant way to do it.