Displaying 1 result from an estimated 1 matches for "topspamm".
Did you mean:
topsham
2006 Jun 07
1
Calling find on AR class, order by association count?
I suspect that this is going to wind up trivial and I''m going to slap
myself in the head...
Suppose I have User and Comment AR classes.
User has_many :comments, Comment belongs_to :user
I want to do a User.find, which returns User objects in order of which
user has the most comments. I suspect that this involves renaming the
COUNT(*) results of a sub-select so that I can order by