ruby-on-rails - 未初始化的常量 OpenSSL (NameError)

标签 ruby-on-rails ruby-on-rails-3 openssl

我一直在开发一个使用 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/

相关文章:

ruby-on-rails - 安装 rails 3 后如何访问 rails 2.3.x 命令?

ruby-on-rails - 如何在一行中使用 if 语句在 Ruby 中设置变量?

ruby - 向 Rails 3 中的延迟作业添加一些自定义方法?

ruby-on-rails-3 - 导轨 3 : Why does my image_tag automatically add inline style attributes to the HTML making it invisible?

openssl - 如何在 openssl 1.0.1 中加载 CRL 路径?

ruby-on-rails - 如何更改 ruby​​ on rails 中的数据库模型?

ruby-on-rails - 卸载并重新安装 Ruby 和 Rails 后,为什么找不到它?

c - AES CTR OpenSSL 命令行与 EVP_aes_128_ctr C 代码不匹配

ruby-on-rails - GitLab 电子邮件未发送?

c++ - C++ 中的 OpenID 库?