has_external_sync.rb 340 B

123456789101112131415
  1. # Copyright (C) 2012-2016 Zammad Foundation, http://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