Class: RailsWorkflow::ErrorWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Worker
Defined in:
app/workers/rails_workflow/error_worker.rb

Instance Method Summary collapse

Instance Method Details

#perform(parent_id, parent_class) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/workers/rails_workflow/error_worker.rb', line 5

def perform(parent_id, parent_class)
  parent = parent_class.constantize.find(parent_id)
  parent.status = parent.class::ERROR
  parent.save

  if parent.respond_to?(:parent_operation) &&
         parent.parent_operation.present?

    perform(
        parent.parent_operation.id,
        parent.parent_operation.class.to_s
    )

  end

  if parent.respond_to?(:process) &&
      parent.process.present?
    perform(parent.process.id, parent.process.class.to_s)
  end

end