Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
will_paginate query with per_page working in rails3
@articles = Article.
select('articles.*, (SUM( = 1)/COUNT( votes_ratio, COUNT( votes_num').
having('votes_num >= 5 AND votes_ratio >= 0.8').
order('votes_ratio DESC, votes_num DESC').
paginate(:page => params[:page], :per_page => Article.per_page)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment