Jets CronJob not working

Hi, this is my ApplicationJob code.

class ApplicationJob < ActiveJob::Base

** rate “1 minute” # fast rate for initial testing**
** def report**
** puts “test”**
** end**

But in jets console, when I run ApplicationJob.perform_now(:report), I am getting this issue.
NoMethodError ( undefined method `report’ for #<ApplicationJob:0x00007fcefbc0e140> )

Could you please help me to fix this issue?
Thank you.

class ApplicationJob < ActiveJob::Base


class ApplicationJob < Jets::Job::Base

Tip: Maybe try the generators to prevent future errors.

1 Like

When I run jets generate job hard

=> Rails app detected: Enabling Jets Afterburner.
create app/jobs/hard_job.rb

But hard_job.rb file is not created.

Oh. Generators don’t work with Afterburner mode. Also Jobs won’t work.

Afterburner mode essentially generates wrapper Jets app and proxies to the Rails app. Docs:

You can sort of still use Jobs. More info here: How to test an Afterburner job from Lambda test events

Yes, I have checked that post.
I created job file in .jets/project/app/jobs
So it is working now.
Thanks a lot.

Hi, how can I call the method in a helper?

This is my job and helper file.

class ReportJob < Jets::Job::Base
include ApplicationHelper

rate “10 minutes”
def report

module ApplicationHelper
def send_file

But I am getting this issue.
NameError ( undefined local variable or method `send_file’ for #<ReportJob:0x00007f824592a3f0> )