title: How to download multiple files from S3 as Zip format in Rails 5.x.x app?
body: <p>I am implementing feature which allows user to either download single file or multiple files from S3.
  Single file downloading is working properly, but for multiple files I am receiving error on Heroku,</p>
  
  <p><code>Errno::ENOENT (No such file or directory @ rb_file_s_lstat )</code></p>
  
  <p>Controller code snippet for downloading files as zip format is as below,</p>
  
  <pre><code>def method_name
     zipfile_name = "#{Rails.root}/public/archive.zip"
     Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile |
       @transfer.transfer_attachments.each do |attachment | 
         zipfile.add(attachment.avatar.file.filename, attachment.avatar.url)
       end
     end
     send_file(File.join("#{Rails.root}/public/", 'archive.zip'), : type =&gt;
  'application/zip', : filename =&gt; "#{Time.now.to_date}.zip")
  end
  </code></pre>
  
  <p>Gemfile</p>
  
  <pre><code>ruby '2.3.1'
  
  gem 'rails', '~&gt; 5.0.1'
  
  gem 'rubyzip', '&gt;= 1.0.0'
  
  gem 'zip-zip'
  </code></pre>
  
  <p>This zipfile functionality works proper with locally stored files.</p>