Merit is a ruby gem for handling reputation (badges, points and rankings) in Rails applications.
Questions tagged [merit-gem]
61 questions
0
votes
2 answers
Rails Merit undefined local variable or method `user' for #
im trying to build a reputation system with rails using the merti gem , im trying to grant a badge when the user creates more than 8 comments however im getting an error undfined method user everytime i create a comment. I m using devise , but i can…

Leo Bogod
- 369
- 8
- 28
0
votes
1 answer
Removal of points using Observer in Merit Rails Gem
Currently in my Observer I add points to Users based on the badges that are assigned to them.
class NewBadgeObserver
def update(changed_data)
return unless changed_data[:merit_object].is_a?(Merit::BadgesSash)
description =…

olliekav
- 165
- 3
- 8
0
votes
0 answers
activerecord - joining multiple tables
I'm using merit gem to add a reputation system to my application. I need to find the amount of points a user added to a Post. The solution I came up with is summing the points the user added to a Post when she did a vote action:
SELECT…

Sajad Rastegar
- 3,014
- 3
- 25
- 36
0
votes
1 answer
Merit gem - prevent users from voting more than once
I'm using Merit gem to add reputation system to my application for users that are logged in.
This is an example of how I'm using score to handle voting:
def initialize
score 5, on: 'posts#upvote', to: :user
score -5, on: 'posts#downvote', to:…

Sajad Rastegar
- 3,014
- 3
- 25
- 36
0
votes
0 answers
How to assign merit points to not_the_current_user
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:…

Andy Harvey
- 12,333
- 17
- 93
- 185
0
votes
1 answer
How to 'back calculate' Merit points?
I'm trying to add a reputation system into an existing app using Merit.
I want to back calculate points for all users based on their historical activity. Merit has quite a complicated internal structure with several tables, and I think I may be…

Andy Harvey
- 12,333
- 17
- 93
- 185
0
votes
1 answer
how to add a new association to library model
I am using merit library in rails. And hope to add an association in Merit::Score::Point so that it has a has_one association with another model call ScoreWorkflow.
Below is my code. In this code, I hope to add an association so that I can add a…

travistam
- 43
- 8
0
votes
0 answers
Ruby on Rails - Merit Gem grant_on Not Being Triggered
So I just installed the merit gem and have been using it to implement badges within my application. I define the badge inside the config/initializers/merit.rb file as so:
badge_id = 0
[{
id: (badge_id = badge_id + 1),
name: 'badge-one',
…

ScottOBot
- 839
- 3
- 16
- 37
0
votes
1 answer
Rails apartment with merit gem
I use the reputation engine Merit and I have added apartment for multitenancy. I want to exclude the merit models and tables.
the following line generates an error:
config.excluded_models= {Merit::Badge}
undefined method `table_name' for…

Nabila Hamdaoui
- 133
- 1
- 6
0
votes
1 answer
merit ruby gem not working with conditional statement
The merit ruby gem is not adding the points to the user with the "user.passion.present" added. It works without it. I set everything up with working with Devise and Merit gems. Everything seems to work except this.
module Merit
class…

CC Evans
- 39
- 7
0
votes
1 answer
Leaderboard API backend with Rails
I'm trying to design an API backend (for a mobile app) around the concept of a leaderboard.
Some of the requirements:
I am interested only in assigning points following the validation of certain rules
the backend should be multi app: app1 should…

rhymes
- 314
- 9
- 16
0
votes
1 answer
Merit gem cron job to check and remove temporary badges
I have a badge rule like this;
grant_on 'comments#create', badge: 'frequent-commenter', to: :user, temporary: true do |comment|
comment.user.comments.where(:created_at.gte => (Date.today - 30)).count >= 20
end
User will lose the badge after sent…

beydogan
- 1,102
- 1
- 11
- 23
0
votes
1 answer
ruby on rails merit gem setting level
Is there is a way to change the user level, something like
user.set_rank(:level => 4) ?
I need to change the user levels but redifining rank rules and running what is suggested here Can the merit gem recalculate reputation and re-evaluate badges…

Mentor
- 3
- 3
0
votes
1 answer
Rails 4: Merit Gem: DRYing up the PointRules code?
Is there a way to DRY the PointRules class up a bit? I tried this but it didn't work:
%w(attr1 attr2 attr3).each do |attribute|
score 10, on: 'comments#create', do |comment|
comment.attribute.present?
end
end
It gave me this error:
private…

John Trichereau
- 626
- 9
- 22
0
votes
2 answers
Merit Gem: expiring points
I'm giving discounts on products based on user's point total. But I would like to encourage users to use those points within 180 days. So, only points created_at < 180.days.ago would count.
What would be a simple way to get the only punctuation from…

alexandrecosta
- 3,218
- 2
- 16
- 16