has_taskbars.rb 382 B

1234567891011121314151617181920212223
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module HasTaskbars
  3. extend ActiveSupport::Concern
  4. included do
  5. before_destroy :destroy_taskbars
  6. end
  7. =begin
  8. destroy all taskbars for the class object id
  9. model = Model.find(123)
  10. model.destroy
  11. =end
  12. def destroy_taskbars
  13. Taskbar.where(key: "#{self.class}-#{id}").destroy_all
  14. end
  15. end