has_online_notifications.rb 451 B

123456789101112131415161718192021
  1. # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
  2. module HasOnlineNotifications
  3. extend ActiveSupport::Concern
  4. included do
  5. before_destroy :online_notification_destroy
  6. end
  7. =begin
  8. delete object online notification list, will be executed automatically
  9. model = Model.find(123)
  10. model.online_notification_destroy
  11. =end
  12. def online_notification_destroy
  13. OnlineNotification.remove(self.class.to_s, id)
  14. end
  15. end