我一直在开发一个使用 OpenSSL 解密数据文件的应用程序,但这在部署到我们的阶段服务器时不起作用。是否需要一些配置步骤来包含我在服务器上错过的 OpenSSL?我没有做任何特别的事情来让它在本地工作(在 Windows 上开发)。
导致错误的行是:
rescue_from OpenSSL::Cipher::CipherError, :with => :cipher_error
在我的一个 Controller 中。
Ruby 1.8.7,Rails 3.0.4
没有使用 gem 来添加 OpenSSL 支持,它只是在本地工作。
文件的实际解密工作正常(代码在
/lib
的模块中),只是 Controller 中的这一行失败了。
最佳答案
您可以尝试明确要求 openssl
require 'openssl'
你用 rvm 安装了 ruby 1.8.7 吗?
如果是这样,你可能想看看这个链接:http://jronallo.github.io/blog/ruby-and-rails-using-rvm-on-a-fresh-and-updated-ubuntu-11-dot-10-install
也许相关的问题:Rails 3 - no such file to load -- openssl
关于ruby-on-rails - 未初始化的常量 OpenSSL (NameError),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16980229/