Sha256: 82b815fb9a6fb9c991789c0eb1a6ace0c80f012f51427446d5505753f6fcdff3

Contents?: true

Size: 617 Bytes

Versions: 9

Compression:

Stored size: 617 Bytes

Contents

module RailsWorkflow
  class ErrorWorker
    include Sidekiq::Worker

    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
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rails_workflow-0.3.7 app/workers/rails_workflow/error_worker.rb
rails_workflow-0.3.6 app/workers/rails_workflow/error_worker.rb
rails_workflow-0.3.5 app/workers/rails_workflow/error_worker.rb
rails_workflow-0.3.4 app/workers/rails_workflow/error_worker.rb
rails_workflow-0.3.3 app/workers/rails_workflow/error_worker.rb
rails_workflow-0.3.2 app/workers/rails_workflow/error_worker.rb
rails_workflow-0.3.1 app/workers/rails_workflow/error_worker.rb
rails_workflow-0.3.0 app/workers/rails_workflow/error_worker.rb
rails_workflow-0.2.2 app/workers/rails_workflow/error_worker.rb