ruby - Rails: Is it possible to have temporary badges with Merit Gem -
i use merit gem create badges , points system on website. however, badges reset after each month. example, monthly badge of 20 comments. require users consistent on site. possible merit? know there "temporary" feature, resets badge based on if conditions no longer met, time-based way reset badges.
thank you!
sure:
grant_on 'comments#create', badge: 'frequent-commenter', to: :user, temporary: true |comment| comment.user.comments.where(:created_at.gte => (date.today - 30)).count >= 20 end
with code badge revoked if condition no longer holds
Comments
Post a Comment