Reputation: 6639
Rails 5.1
In my Gemfile, I have:
gem 'delayed_job'
gem 'delayed_job_active_record'
gem 'daemons'
In app/jobs/application_job.rb, I have:
class ApplicationJob < ActiveJob::Base
end
In app/jobs/create_csv.rb, I have:
class CreateCsvJob < ApplicationJob
queue_as :default
def perform(followed_id)
........
end
end
In app/controllers/fw_exports_controller.rb, I have:
def create_csv
CreateCsvJob.perform_later(params[:followed_id])
redirect_to root_path, notice: t('fw_exports.spreadsheet_export.csv_generation_started')
end
But, when I run the action to create a CSV, I get the following error:
uninitialized constant FwExportsController::CreateCsvJob
However, I have another delayed action, that's working fine
In app/controllers/fw_exports_controller.rb, I have:
def process_parsed_spreadsheet
ParseAndProcessSpreadsheetJob.perform_later(params[:temp_file_path], params[:followed_id])
redirect_to root_path, notice: t('fw_exports.file_successfully_imported')
end
In app/jobs/parse_and_process_spreadsheet_job.rb, I have:
class ParseAndProcessSpreadsheetJob < ApplicationJob
queue_as :default
def perform(temp_file_path, followed_id)
.........
end
end
The latter one, runs fine. Any ideas?
Upvotes: 0
Views: 66
Reputation: 516
Change the filename of create_csv.rb to create_csv_job.rb. Does that help?
Upvotes: 1