In Rails' console app
is defined as
[1] pry(main)> app
=> #<ActionDispatch::Integration::Session:0x000000189028e8
Now, I have a simple job like:
class MyJob < ActiveJob::Base
queue_as :low
def perform
app.get('/my/path', nil, {'Accept-Language' => "it"})
end
end
If I call MyJob.perform_now
I get
NameError: undefined local variable or method `app' for
How can I use app
in a Rails' ActiveJob?
class MyJob < ActiveJob::Base
queue_as :low
def perform
app = ActionDispatch::Integration::Session.new(Rails.application)
app.get('/my/path', nil, {'Accept-Language' => "it"})
end
end