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 badge has been issued -- even though I have surpassed the threshold --
Also I am uncertain how to display the badges --- I am using:
<%= current_user.badges %>
Right now all I get is brackets -- what I want it to return is an image of the badge ---
Any assistance greatly appreciated.
To anyone else with a similar question: I finally was able to display the badges using the following: