I have an issue with the merit gem that seems too obvious/easy, but struggled to figure it out.
I am using the sample observable class and it works fine for points. Every point change, the registered observer receives the update. However, for badges no such update occurs.
How I am assigning the badge to the user MIGHT be the reason but I am uncertain why. Again using an example from the wiki, I am looking at the total points for the user and creating the appropriate badge for that user using the add_badge
method. This works fine. That is, points are being tallied as expected, badges are being created as expected, and the user's points and badges are correct.
The issue is that the observable class does not receive any update / event for these badge assignments. I was expecting each add_badge
to generate the notification.
What are some reasons why the badge addition is not being observed?
The Observers are notified when the reputation (points, ranking or badges) are granted through the rules defined in app/models/merit
. The Judge
object takes care of this.
When you grant reputation "by hand" (calling add_badge
) you need to call the observer manually, as in that sample code from Judge
.