I'm trying to zip folder with rubyzip gem, I got this error :
uninitialized constant Zip::File::Create
this the method that create the zip :
def self.zip_pdf( report, paths )
if File.exist?("#{Rails.root}/tmp/pdf/reports/#{report.reference}.zip")
FileUtils.rm("#{Rails.root}/tmp/pdf/reports/#{report.reference}.zip")
end
directory = File.join( File.dirname( paths[0] ) )
zipfile_name = File.join( File.dirname( paths[0] ) ) + '.zip'
Zip::ZipFile.open( zipfile_name, Zip::ZipFile::Create ) do |zipfile|
Dir[ File.join( directory , '*' ) ].each do |file|
zipfile.add( file.basename( file ), file )
end
end
end
I followed the doc but still don't know why it show that error !