find_with_reputation
またはcount_with_reputation
のメソッドを実行しようとすると次のエラーが発生します。Rails - ActiveRecordレピュテーションシステムスコープクエリの問題
ArgumentError: Evaluations of votes must have scope specified
次のように私のモデルが定義されている:
class Post < ActiveRecord::Base
has_reputation :votes,
:source => :user,
:scopes => [:up, :down]
私は、たとえば実行しようとするとエラーが発生します
Post.find_with_reputation(:votes, :up)
または
Post.find_with_reputation(:votes, :up, { order: "likes" })
残念ながら、 documentationこのエラーを回避する方法についてはあまり明確ではありません。それだけで次のようにメソッドが実行されなければならないと述べている:任意の助けが最も理解されるであろう
User.find_with_reputation(:karma, :all)
:なしモデルで
ActiveRecord::Base.find_with_reputation(:reputation_name, :scope, :find_options)
はActiveRecordのレピュテーションシステムのような方法でうまく動作スコープ。