I am attempting to use rubyzip to create zip archives on the fly in my app. I'm using their readme as a starting point. I added the gem to my Gemfile:
gem 'rubyzip'
Then ran bundle install
and restarted the rails server.
My controller code is:
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'm getting is: cannot load such file -- zip
I've tried require 'zip/zip'
but it produces the same error.
Thanks in advance!