I am using merit gem in my rails project and the merit observer is not working at all. I have reputation_change_observer.rb in my app/observers/ folder
#reputation_change_observer.rb
class ReputationChangeObserver
observe :user
def update(changed_data)
description = changed_data[:description]
# If user is your meritable model, you can query for it doing:
user = User.where(sash_id: changed_data[:sash_id]).first
user.update_life_time_point
user.give_badges
# When did it happened:
datetime = changed_data[:granted_at]
end
end
When the reputation changes I am updating the life time point of the user. And gives the badges if the user point reaches certain point. But these two functionalities are not working. Anyone has any idea? what would be the issue?