has_external_sync.rb 342 B

12345678910111213141516
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. module ApplicationModel::HasExternalSync
  3. extend ActiveSupport::Concern
  4. included do
  5. after_destroy :external_sync_destroy
  6. end
  7. def external_sync_destroy
  8. ExternalSync.where(
  9. object: self.class.to_s,
  10. o_id: id,
  11. ).destroy_all
  12. end
  13. end