I am trying to use rubyzip to create zip archives on the fly in my application. I use their readme as a starting point. I added gem to my gemfile:
gem 'rubyzip'
Then ran bundle install and restarted the rails server.
My controller code:
require 'rubygems' require 'zip' filename = "#{Time.now.strftime('%y%m%d%H%M%S')}" input_filenames = ["#{filename}.txt"] zip_filename = "#{filename}.zip" Zip::File.open(zip_filename, Zip::File::CREATE) do |zipfile| input_filenames.each do |f| zipfile.add(f, directory + '/' + f) end end
The error I get: cannot load such file -- zip
I tried require 'zip/zip' , but it throws the same error.
Thanks in advance!
source share