I’m implementing the activerecord-reputation-system gem and having an issue scoping the most ‘loved’ articles.
/articles_controller
def index
....
@loved_articles = Article.page(params[:page]).find_with_reputation(:votes, :all, {:order => 'votes DESC, created_at DESC'})
....
end
I tried calling .per(5) after [:page]).per(5)…. but rails gave me an “undefined method `per'” error
/article model
def self.loved
find_with_reputation(:votes, :all, {:order => 'votes DESC'}).first(5)
end
–
I would imagine calling .first(5) would scope it, but nothing is happening – in my views, the loop is just chewing through all my articles. Any ideas?
Never mind – I’m not using pagination…
Added
@loved_articles = Article.lovedin my controller