4

I've added a helper method to my Application controller:

def unzip (file, destination)
    Zip::File.open(file) do |zip_file|
        zip_file.each do |f|
            f_path = File.join(destination, f.name)
            FileUtils.mkdir_p(File.dirname(f_path))
            f.extract(f_path) 
        end
    end
end

and I get the error:

private method `open' called for Zip::File:Class

When I run this in the Interactive Ruby shell, it works fine. How do I implement this on Rails 4?

zishe
  • 10,665
  • 12
  • 64
  • 103
astronomotrous
  • 431
  • 1
  • 3
  • 12

0 Answers0