My request object for my sidekiq worker is being recognized as a string.
application_controller.rb
def log_variant
@request = request
AnalyticsWorker.perform_async(@request)
end
variant_worker.rb
class VariantWorker
include Sidekiq::Worker
def perform(current_request)
variant = current_request.variant.join
puts variant
end
end
Here is the error
undefined method `variant' for "#<ActionDispatch::Request:0x00000101b83510>":String
I'm storing the request object in an instance variable so I should be able to call the variant method on it yes? Is the request object too complex to perform this sidekiq operation?
In the background, Sidekiq is serializing that parameter into Redis. I'm guessing Redis is casting it down to a string. In general, you want to pass minimal data in that parameter as noted here.