我创建新作业SelectionJob
,然后我在控制器中使用:
Delayed::Job.enqueue SelectionJob.new(type, application, @current_user, @selection)
当我运行rake jobs:work
时,我收到以下错误:
ArgumentError:无法将不响应执行
的项目排入队列
我的工作代码:
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
我的控制器动作:
def new
download_type_result = Delayed::Job.enqueue SelectionJob.new(type, application, @current_user, @selection)
if download_type_result
flash[:success] = 'Success'
end
end
那么,我该如何修复错误?