title: Ruby resque background CSV import does not run
body: <p>I am trying to import a CSV file using a background job with resque.  It appears to run but nothing happens.   The import worked fine when I was not using resque (I am using resque because some imports are large and I want to move to a background job, for testing its a small 2 row csv) </p>
  
  <p>Any help is super appreciated, thank you very much!
  (also im a beginner so please dumb down any help :))</p>
  
  <p>inventories_controller.rb  :</p>
  
  <pre><code>  def import
      Resque.enqueue(Inventorycsvimport, params[:file], current_user.id)
      redirect_to root_url, notice: "Inventory import job started."
    end
  </code></pre>
  
  <p>worker JOB  inventorycsvimport.rb  :</p>
  
  <pre><code>class Inventorycsvimport
    @queue = :Inventorycsvimport
    def self.perform()
      Inventory.destroy_all(user_id: current_user.id)
      Inventory.import(params[:file], current_user.id)
    end
  end
  </code></pre>
  
  <p>Import Class inventory.rb  :</p>
  
  <pre><code>class Inventory &lt; ApplicationRecord
      belongs_to :user
  
    def self.import(file, user_id)
      allowed_attributes = [ "user_id", "id","description","part_number","price","created_at","updated_at", "alternate_part_number", "condition_code", "qty", "mfg_code", "serial_number", "part_comments"]
      spreadsheet = open_spreadsheet(file)
      header = spreadsheet.row(1)
      (2..spreadsheet.last_row).each do |i|
        row = Hash[[header, spreadsheet.row(i)].transpose]
        inventory = find_by_id(row["id"]) || new
        inventory.attributes = row.to_hash.select { |k,v| allowed_attributes.include? k }
        inventory.user_id = user_id
        inventory.save!
      end
    end
  
    def self.open_spreadsheet(file)
      case File.extname(file.original_filename)
        when ".csv" then Roo::CSV.new(file.path)
        when ".xls" then Excel.new(file.path, nil, :ignore)
        when ".xlsx" then Excelx.new(file.path, nil, :ignore)
      else raise "Unknown file type: #{file.original_filename}"
      end
    end
  end
  </code></pre>
  
  <p>This is the error I get in the JOB:</p>
  
  <p><a href="https://i.stack.imgur.com/U7K7N.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/U7K7N.png" alt="enter image description here"></a></p>