title: Rails 5.2 Import XLSX with ActiveStorage and Creek
body: <p>I have a model called <code>ImportTemp</code> which is used for store imported XLSX file to database. I'm using ActiveStorage for storing the files.</p>
  
  <p>this is the model code:
  </p>
  
  <pre><code>class ImportTemp &lt; ApplicationRecord
    belongs_to :user
    has_one_attached :file
    has_one_attached :log_result
  end
  </code></pre>
  
  <p>this is my import controller code:
  </p>
  
  <pre><code>def import
    # Check filetype
    case File.extname(params[:file].original_filename)
    when ".xlsx"
      # Add File to ImportFile model
      import = ImportTemp.new(import_type: 'UnitsUpload', user: current_user)
      import.file.attach(params[:file])
      import.save
  
      # Import unit via sidekiq with background jobs
      ImportUnitWorker.perform_async(import.id)
  
      # Notice
      flash.now[:notice] = "We are processing your xlsx, we will inform you after it's done via notifications."
      # Unit.import_file(xlsx)
    else flash.now[:error] = t('shared.info.unknown')+": #{params[:file].original_filename}"
    end
  end
  </code></pre>
  
  <p>after upload the xlsx file, then the import will be processed in sidekiq. This is the worker code (still doesn't do the import actually) :</p>
  
  <pre class="lang-rb prettyprint-override"><code>class ImportUnitWorker
    include Sidekiq::Worker
    sidekiq_options retry: false
  
  def perform(file_id)
    import_unit = ImportTemp.find(file_id)
  
    # Open the uploaded xlsx to Creek
    creek = Creek::Book.new(Rails.application.routes.url_helpers.rails_blob_path(import_unit.file, only_path: true))
    sheet = creek.sheets[0]
  
    puts "Opening Sheet #{sheet.name}"
    sheet.rows.each do |row|
      puts row
    end
  
    units = []
  
    # Unit.import(units)
  end
  </code></pre>
  
  <p>but after i tried it, it gives me error:</p>
  
  <pre><code>Zip::Error (File /rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--3960b6ba5b55f7004e09967d16dfabe63f09f0a9/2018-08-10_10_39_audit_gt.xlsx not found)
  </code></pre>
  
  <p>but if i tried to open it with my browser, which is the link looks like this:</p>
  
  <pre><code>http://localhost:3000/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--3960b6ba5b55f7004e09967d16dfabe63f09f0a9/2018-08-10_10_39_audit_gt.xlsx
  </code></pre>
  
  <p>it's working and the xlsx is downloaded. My question is what's wrong with it? why the file is not found in the sidekiq?</p>