I remember when I tried passing a params (JSON) option to a sidekiq worker method and it didn't work out well because I was referencing the option like:
options[:email_address]
But I think it would have worked if I did:
options["email_address"]
So for some reason when it gets serialized and deserialized the hash can only be referenced with a string not a symbol.
Is this a safe practise?
I have a transaction email worker that looks like:
class TransactionEmailWorker
include Sidekiq::Worker
def perform(action, options)
case action
when 'welcome'
welcome(options["email_address"], options["something_else"])
when 'reset_password'
reset_password(options["email_address"])
end
end
def welcome(email, title)
# ...
end
def reset_password(email)
# ..
end