I create new job SelectionJob
, then I call this in my controller using:
Delayed::Job.enqueue SelectionJob.new(type, application, @current_user, @selection)
When I run rake jobs:work
, I get the following error:
ArgumentError: Cannot enqueue items which do not respond to perform
My job code:
class SelectionJob < Struct.new(:type, :application, :current_user, :selection)
def perform
Person.create(type: type, application: application, current_user: current_user, selection: selection)
end
end
And my controller action:
def new
download_type_result = Delayed::Job.enqueue SelectionJob.new(type, application, @current_user, @selection)
if download_type_result
flash[:success] = 'Success'
end
end
So, how can I fix my error?