使用 rubyzip 错误 - 没有要加载的文件 - zip/zip [英] Using rubyzip error - no such file to load -- zip/zip
问题描述
我知道这个主题还有另一个主题,但即使在使用所有解决方案后我仍然面临这个问题.有没有其他方法可以生成 zip 文件?我可以使用 Ubuntu 系统命令吗?
I know there is another thread on this subject but I still face this problem even after using all solutions. Is there any other way to generate zip files? Can i use Ubuntu system commands?
我做到了
gem install rubyzip
我有
require 'rubygems'
require 'zip/zip'
在我的控制器中
但我仍然遇到同样的错误 - 没有要加载的文件 - zip/zip我在 Ubuntu 上尝试使用带有 rails 3.0.5 的 ruby 1.8.7 和 ruby 1.9.2
But i still get the same error - no such file to load -- zip/zip I tried with both ruby 1.8.7 and ruby 1.9.2 with rails 3.0.5 on Ubuntu
你能帮帮我吗?谢谢.
推荐答案
花了很多时间,终于找到了缺失的部分.使用 rubyzip
gem 时,我还必须要求 zip/zip
.
After spending lot of time, I finally figured out the missing part. When using the rubyzip
gem, I also had to require zip/zip
.
将此添加到您的 Gemfile 中
Add this to your Gemfile
gem 'rubyzip', :require =>'zip/zip'
仅添加 gem 'rubyzip
对我不起作用.
Just adding gem 'rubyzip
did not work for me.
这篇关于使用 rubyzip 错误 - 没有要加载的文件 - zip/zip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!