besquared successfully answered Rich Collins's question:

I have the following schema:

users
id

posts
id
user_id

I want to paginate users orderded by the number of posts for each user. This does not work:

User.find(:all, :include => :posts, :group => 'user_id', :order => 'count(user_id)')

Any suggestions?

People succeed in answering Rich Collins's questions 37% of the time (32 successes in 86 attempts).

Answers by: besquared

besquared's Answer:

Reply by besquared 784 days ago

(04:08:20) richcollins: so I can have up_vote_count
(04:08:28) besquared: yeah
(04:08:32) besquared: and down_vote_count
(04:08:45) richcollins: you would need to generate each time you apply acts_as_voteable to a model
(04:08:50) besquared: yes
(04:08:52) richcollins: ok that is pretty benign
(04:09:03) richcollins: besquared, go to guruza and get your reward

Reply by Rich Collins 784 days ago

Thanks! I forgot about counter_cache