Active Record order by group size

Viewed 2918

I've got an active record query where I'm using group_by

@foo = Foo.group_by(&:relation)

Then in the view i'm using

@foo.each do |group, values|
 group x has values.count elements
end

Is there a way I could sort these by the count of each group?

1 Answers
Related