Class: GlobalRegistry::Bindings::Workers::PushRelationshipWorker

Inherits:
GlobalRegistry::Bindings::Worker show all
Includes:
Entity::PushRelationshipMethods, Entity::RelationshipTypeMethods
Defined in:
lib/global_registry_bindings/workers/push_relationship_worker.rb

Instance Attribute Summary collapse

Attributes inherited from GlobalRegistry::Bindings::Worker

#model

Instance Method Summary collapse

Methods included from Entity::PushRelationshipMethods

#create_relationship_in_global_registry, #delete_relationship_from_global_registry, #ensure_related_entities_have_global_registry_ids!, #global_registry_relationship_entity_id_from_entity, #push_primary_to_global_registry, #push_related_to_global_registry, #push_relationship_to_global_registry, #put_relationship_to_global_registry, #relationship, #relationship_entity, #valid_update?

Methods included from Entity::RelationshipTypeMethods

#primary_associated_entity_type_id, #push_global_registry_relationship_type, #push_global_registry_relationship_type_fields, #related_associated_entity_type_id, #relationship_type_cache_key, #rename_relationship_entity_type

Methods inherited from GlobalRegistry::Bindings::Worker

perform_async, perform_async_real

Constructor Details

#initialize(model = nil, type = nil) ⇒ PushRelationshipWorker

Returns a new instance of PushRelationshipWorker.



17
18
19
20
# File 'lib/global_registry_bindings/workers/push_relationship_worker.rb', line 17

def initialize(model = nil, type = nil)
  super model
  self.type = type.to_sym if type
end

Instance Attribute Details

#typeObject

Returns the value of attribute type.



15
16
17
# File 'lib/global_registry_bindings/workers/push_relationship_worker.rb', line 15

def type
  @type
end

Instance Method Details

#perform(model_class, id, type) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/global_registry_bindings/workers/push_relationship_worker.rb', line 22

def perform(model_class, id, type)
  super model_class, id
  self.type = type.to_sym
  push_relationship_to_global_registry
rescue ActiveRecord::RecordNotFound # rubocop:disable Lint/HandleExceptions
  # If the record was deleted after the job was created, swallow it
end