Sha256: 25652ce85cdadf92160345af7f6938d53d91126d449f99b123a14e1292104c22

Contents?: true

Size: 801 Bytes

Versions: 4

Compression:

Stored size: 801 Bytes

Contents

# frozen_string_literal: true

require "global_registry_bindings/workers/pull_mdm_id_worker"

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

        included do
          GlobalRegistry::Bindings::Workers.mdm_worker_class(self)
          after_commit :pull_mdm_id_from_global_registry_async, on: %i[create update]
        end

        def pull_mdm_id_from_global_registry_async
          return if global_registry_entity.condition?(:if)
          return unless global_registry_entity.condition?(:unless)
          "::GlobalRegistry::Bindings::Workers::#{global_registry_entity.mdm_worker_class_name}"
            .constantize.perform_async(self.class.name, id)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
global-registry-bindings-0.7.2 lib/global_registry_bindings/model/pull_mdm.rb
global-registry-bindings-0.7.1 lib/global_registry_bindings/model/pull_mdm.rb
global-registry-bindings-0.7 lib/global_registry_bindings/model/pull_mdm.rb
global-registry-bindings-0.6.3 lib/global_registry_bindings/model/pull_mdm.rb