私はactiverecord-reputation-system gemを実装しており、最も「愛されている」記事の範囲を特定するのに問題があります。
/articles_controller
def index
....
@loved_articles = Article.page(params[:page]).find_with_reputation(:votes, :all, {:order => 'votes DESC, created_at DESC'})
....
end
[:page]).per(5).... の後に .per(5) を呼び出してみましたが、Rails で「undefined method `per'」エラーが発生しました
/article model
def self.loved
find_with_reputation(:votes, :all, {:order => 'votes DESC'}).first(5)
end
-
.first(5) を呼び出すと範囲が広がると思いますが、何も起こっていません。私の見解では、ループはすべての記事をかじっているだけです。何か案は?