I am attempting to add Merit reputation system into a Rails app.
I have a votes model, and I want to award Merit points to the owners of objects that have been voted on.
#models/merit/point_rules.rb
score 2, on: 'votes#create', to: :owner_of_object_voted_on
and with
class Vote
belongs_to :voter, class_name: 'User'
belongs_to :votable, polymorphic: true
def owner_of_object_voted_on
case self.votable_type
when 'blog_post'
votable.owner
end
end
end
class BlogPost
has_many :votes
belongs_to :owner, class_name: 'User'
end
However, Merit is awarding points always to the current_user, rather than the object owner.
Does score to:
take a symbol that represents a method on the vote
model, and am I setting this up correctly?
The relevant source indicates that :action_user is being used, but I'm unclear where this is defined and whether it can be overwritten.