Sha256: 6b06621f67648a04ad97ee6519327a5f49af66f606b91d4832e4af97059f1ca1

Contents?: true

Size: 746 Bytes

Versions: 10

Compression:

Stored size: 746 Bytes

Contents

# frozen_string_literal: true

require 'global_registry_bindings/workers/delete_entity_worker'

module GlobalRegistry #:nodoc:
  module Bindings #:nodoc:
    module Model #:nodoc:
      module DeleteEntity
        extend ActiveSupport::Concern

        included do
          after_commit :delete_entity_from_global_registry_async, on: :destroy
        end

        def delete_entity_from_global_registry_async
          return unless global_registry_entity.id_value?
          return if global_registry_entity.condition?(:if)
          return unless global_registry_entity.condition?(:unless)
          ::GlobalRegistry::Bindings::Workers::DeleteEntityWorker.perform_async(global_registry_entity.id_value)
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
global-registry-bindings-0.6.2 lib/global_registry_bindings/model/delete_entity.rb
global-registry-bindings-0.6.1 lib/global_registry_bindings/model/delete_entity.rb
global-registry-bindings-0.6.0 lib/global_registry_bindings/model/delete_entity.rb
global-registry-bindings-0.5.0 lib/global_registry_bindings/model/delete_entity.rb
global-registry-bindings-0.4.0 lib/global_registry_bindings/model/delete_entity.rb
global-registry-bindings-0.3.3 lib/global_registry_bindings/model/delete_entity.rb
global-registry-bindings-0.3.2 lib/global_registry_bindings/model/delete_entity.rb
global-registry-bindings-0.3.1 lib/global_registry_bindings/model/delete_entity.rb
global-registry-bindings-0.3.0 lib/global_registry_bindings/model/delete_entity.rb
global-registry-bindings-0.2.0 lib/global_registry_bindings/model/delete_entity.rb