Module: GlobalRegistry::Bindings::Model::PushRelationship

Extended by:
ActiveSupport::Concern
Defined in:
lib/global_registry_bindings/model/push_relationship.rb

Instance Method Summary collapse

Instance Method Details

#delete_relationships_from_global_registry_async(*types) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/global_registry_bindings/model/push_relationship.rb', line 25

def delete_relationships_from_global_registry_async(*types)
  types = types.empty? ? self.class.global_registry_relationship_types : types
  types.each do |type|
    next unless global_registry_relationship(type).id_value?
    next if global_registry_relationship(type).condition?(:if)
    next unless global_registry_relationship(type).condition?(:unless)
    ::GlobalRegistry::Bindings::Workers::DeleteEntityWorker.perform_async(
      global_registry_relationship(type).id_value
    )
  end
end

#push_relationships_to_global_registry_async(*types) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/global_registry_bindings/model/push_relationship.rb', line 17

def push_relationships_to_global_registry_async(*types)
  types = types.empty? ? self.class.global_registry_relationship_types : types
  types.each do |type|
    action = global_registry_relationship_change_action(type)
    send("global_registry_relationship_async_#{action}".to_sym, type)
  end
end