How can I run an ActiveJob in Rails console for debugging?
You can run a job with perform_now
.
For example...
class Foo < ActiveJob::Base
def perform(arg1)
puts "Hello #{arg1}"
end
end
Foo.perform_now('world')
You can temporarily set your queue adapter to inline.
Right now your code in application.rb
will look something like this:
Rails.application.config.active_job.queue_adapter = :sidekiq
Just comment out the line
# Rails.application.config.active_job.queue_adapter = :sidekiq
This will run your job inline, and you should see the results in the console.
You can run with new, Eg.Foo.new.perform(ar_1, ar_2)