module Operation::Worker

only kicks in when Operation::run, run will still do it real-time Works with Reform 2, only.

Public Class Methods

included(base) click to toggle source
# File lib/trailblazer/operation/worker.rb, line 10
def self.included(base)
  base.send(:include, Sidekiq::Worker)
  base.extend(ClassMethods)
end

Public Instance Methods

perform() click to toggle source
# File lib/trailblazer/operation/worker.rb, line 54
def perform#(params)
  # the serialized params hash from Sidekiq contains a Op::UploadedFile hash.

  # the following code is basically what happens in a controller.
  # this is a bug in Rails, it doesn't work without requiring as/hash/ina
  # params = ActiveSupport::HashWithIndifferentAccess.new_from_hash_copying_default(params) # TODO: this might make it ultra-slow as Reform converts it back to strings.
  params = @params.with_indifferent_access
  @params = deserializable(params)
  run
end

Private Instance Methods

deserializable(params) click to toggle source
# File lib/trailblazer/operation/worker.rb, line 66
def deserializable(params)
  params # this is where we convert file uloads into Trailblazer::UploadedFile, etc. soon.
end