Sha256: 995006216cf82b5004e9e42a7d035c1b31c555769941e87b3fcf1543a4ff2b3b

Contents?: true

Size: 799 Bytes

Versions: 2

Compression:

Stored size: 799 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

2 entries across 2 versions & 1 rubygems

Version Path
global-registry-bindings-0.6.2 lib/global_registry_bindings/model/pull_mdm.rb
global-registry-bindings-0.6.1 lib/global_registry_bindings/model/pull_mdm.rb