merit-gem

Can the merit gem recalculate reputation and re-evaluate badges and ranks?

故事扮演 提交于 2020-01-11 05:44:09
问题 I would like to add a system of points, ranks and badges in my rails app. The merit gem looks cool, but I want to make sure how it works before using it. The way you define badges # app/models/merit/badge_rules.rb grant_on 'comments#vote', :badge => 'relevant-commenter', :to => :user do |comment| comment.votes.count == 5 end and points # app/models/merit/point_rules.rb score 10, :to => :post_creator, :on => 'comments#create' do |comment| comment.title.present? end suggest that the action is

Rails 3.2 Merit Gem Badge not Working

拈花ヽ惹草 提交于 2019-12-11 11:28:36
问题 I've read all the current questions and answers about the Merit gem. And attempted to follow the solution given here Rails: Merit Gem Badge Not Registering or Displaying initializers/merit.rb: # Use this hook to configure merit parameters Merit.setup do |config| # Check rules on each request or in background config.checks_on_each_request = true # Define ORM. Could be :active_record (default) and :mongo_mapper and :mongoid config.orm = :active_record # Define :user_model_name. This model will

Rails 4: Creating point rules using merit gem

蓝咒 提交于 2019-12-07 10:29:50
问题 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',

Rails: Merit Gem Badge Not Registering or Displaying

与世无争的帅哥 提交于 2019-12-04 02:21:47
问题 I set up the following badge which registered in DB: merit.rb Merit::Badge.create!({ id: 1, name: 'Five Tasks' custom_fields: { img_url: '/images/badge.gif' } }) I set up the following rule: badge_rules.rb grant_on 'tasks#create', :badge => 'Five Tasks', :temporary => true, :model_name => 'Task' do |task| task.user_ids.count == 5 end What I wanted to to happen is when the User created 5 tasks they would be issued a badge. I see entries in the DB in merit_actions and merit_activity_log entries

Rails: Merit Gem Badge Not Registering or Displaying

北慕城南 提交于 2019-12-01 14:27:07
I set up the following badge which registered in DB: merit.rb Merit::Badge.create!({ id: 1, name: 'Five Tasks' custom_fields: { img_url: '/images/badge.gif' } }) I set up the following rule: badge_rules.rb grant_on 'tasks#create', :badge => 'Five Tasks', :temporary => true, :model_name => 'Task' do |task| task.user_ids.count == 5 end What I wanted to to happen is when the User created 5 tasks they would be issued a badge. I see entries in the DB in merit_actions and merit_activity_log entries -- but I do not see anything in the badges_sashes which I assume is where they would show when the

Can the merit gem recalculate reputation and re-evaluate badges and ranks?

爷,独闯天下 提交于 2019-12-01 06:42:29
I would like to add a system of points, ranks and badges in my rails app. The merit gem looks cool, but I want to make sure how it works before using it. The way you define badges # app/models/merit/badge_rules.rb grant_on 'comments#vote', :badge => 'relevant-commenter', :to => :user do |comment| comment.votes.count == 5 end and points # app/models/merit/point_rules.rb score 10, :to => :post_creator, :on => 'comments#create' do |comment| comment.title.present? end suggest that the action is done as a hook, just after the action ( comments#vote or comments#create ) in those cases. I havn't