lib/merit/rule.rb
# Grant badge if rule applies. If it doesn't, and the badge is temporary,
# then remove it.
Grant badge if rule applies. If it doesn't, and the badge is temporary,
then remove it.
Grant badge if rule applies . If it doesn ' t and the badge is temporary then remove it .
def grant_or_delete_badge(action)
      unless (sash = sash_to_badge(action))
        Rails.logger.warn "[merit] no sash found on Rule#grant_or_delete_badge"
        return
      end
      if applies? action.target_object(model_name)
        if badge.grant_to(sash)
          action.log!("badge_granted:#{badge.name}")
        end
      elsif temporary?
        if badge.delete_from(sash)
          action.log!("badge_removed:#{badge.name}")
        end
      end
    end
def grant_or_delete_badge ( action ) unless ( sash = sash_to_badge ( action ) ) Rails . logger . warn "[merit] no sash found on Rule#grant_or_delete_badge" return end if applies? action . target_object ( model_name ) if badge . grant_to ( sash ) action . log! ( "badge_granted:#{badge.name}" ) end elsif temporary? if badge . delete_from ( sash ) action . log! ( "badge_removed:#{badge.name}" ) end end end
Grant badge if rule applies.
Grant badge if rule applies .
action