0

In my controller

  def upload
    @file = params[:file_xlsx]
    Category.delay.upload_process(@file.tempfile, params[:id])
    redirect_to action: "show", id: params[:id]
  end

On My Model

  def self.upload_process(file, id)

    xlsx = Roo::Excelx.new(file)
    .........
  end

The error:

undefined method `name' for nil:NilClass

Works perfect without "delayed_job", but does not work with "delayed_job", what can be wrong?

1 Answers1

0

Try Following.put delay at the end

def upload
  @file = params[:file_xlsx]
  Category.upload_process(@file, params[:id]).delay
  redirect_to action: "show", id: params[:id]
end
Santosh Sharma
  • 2,114
  • 1
  • 17
  • 28