Rails production 中出现uninitialized constant Digest::SHA1 解决办法

今天在Rails production中登录时发现了500错误,提示uninitialized constant Digest::SHA1,于是上网搜资料,如下:

 

I'm trying to deploy a rails app to joyent/textdrive for the first time.  All works well until I try to access Digest::SHA1.

I get the following:

NameError (uninitialized constant Digest::SHA1):
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:263:in `load_missing_constant'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:452:in `const_missing'
    /app/models/user.rb:48:in `encrypted_password'
    /app/models/user.rb:20:in `authenticate'
    /app/controllers/login_controller.rb:9:in `login'
    /vendor/rails/actionpack/lib/action_controller/base.rb:1095:in `send'

etc.

While I didn't need to explicitly require digest/sha1 on my local box, I took this to mean that maybe on the production box I do.

I've tried placing the "require 'digest/sha1'" statement both at the top of my user.rb class and at the bottom of the environment.rb file, and have restarted both lighttpd and rails, but continue to get the same error.

I have run the rails:freeze:gems task and copied the entire vendor package to production.

Anyone have any ideas why I keep getting this exception or how to solve this?

Thanks!
-Drew

 

 

最后作者找到了解决方法:

 

Upon much experimentation I found that rather than just restarting the rails app via the

./script/process/reaper -a reload

command, I rather needed to physically kill the processes for lighttpd and rails and manually restart in order for the require statement to start working.  I'm not sure if this was a caching issue or if a full killing and restart of all processes was actually needed to load the digest library.

Anyway, things are working happily now.

Thanks,
-Drew

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值