Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Point Targets #15

Closed
jodyalbritton opened this issue Jul 2, 2012 · 1 comment
Closed

Point Targets #15

jodyalbritton opened this issue Jul 2, 2012 · 1 comment

Comments

@jodyalbritton
Copy link

Can you clarify point granting? For example, in the point rules you can set

:to => [:reviewer, :reviewed]

Where is the reviewer or reviewed defined? I want to grant points to a user when someone likes one of their activities. I have a likes#create action, and want to grant points to like.target.

@tute
Copy link
Member

tute commented Jul 5, 2012

Hi! in https://github.com/tute/merit#defining-point-rules you can see the docs a bit improved. Those methods are defined in the model, in the example case, reviewer and reviewed methods are required in the Review model -either as relations or explicit methods- which return a meritable resource (a user for instance).

In your case, the rule should look something like:

score 15, :on => 'likes#create', :to => :target

Assuming the existence of a Like model with a target method (which returns the "liked" user), after creation of a like target user will be granted 15 points.

@tute tute closed this as completed Jul 5, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants