I am in the process of converting my app's voting and reputation system from activerecord-reputation-system to merit because the latter seems to have a much more active core team.
I'm attempting to establish point rules for voting on questions and answers in my app. Ideally, when a user votes up a question, the rule would allocate points to the question itself, and also to the question's creator.
From merit's readme section on point rules, I see this example:
score 15, on: 'reviews#create', to: [:reviewer, :reviewed]
My understanding is that :reviewer
and reviewed
in this example are the ones that get the points allocated to them. However, when I try this in my own point_rules.rb:
score 10, :on => 'questions#vote', :to => :question
I get the following error:
[merit] NoMethodError on `Question#question` (called from Merit::TargetFinder#other_target)
I know that I am missing something here, but can someone please tell me what it is?
Merit works like this:
If you define a rule without specify to whom, the points will be assigned to current_user by default
If you want to assign points to an user outside of current_user, specify it
In above example,
:user
refers to methodquestion.user
, who is the author of the question, different from current_user who voted this.In OP's case, actually ActiveRecord Reputation and Merit are for different purpose and can't be fully interchanged.
ARP can be used on all models, including users and non-users. Meirt is for user only.
Merit has another module for badge. ARP doesn't.
Merit has a Rule module where you can define all rules in one place, like CanCan. While in ARP there is no such place.
You'll deal with models mainly in ARP. In Merit, you'll work with both Controller and Model.