Rails 3 App on ruby​​ 1.9.2神秘地缺少Base64方法

时间:2012-10-03 16:04:26

标签: ruby-on-rails ruby-on-rails-3 actionpack

尝试在Rails ApplicationController中实现HTTP摘要身份验证,但在调用authenticate_or_request_with_http_digest(REALM)时遇到意外异常:

undefined method `unpack' for nil:NilClass 

堆栈跟踪的顶部:

/Users/chadmiko/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/base64.rb:58:in
`decode64' actionpack (3.2.8)
lib/action_controller/metal/http_authentication.rb:301:in
`validate_nonce' actionpack (3.2.8)
lib/action_controller/metal/http_authentication.rb:188:in
`validate_digest_response' actionpack (3.2.8)
lib/action_controller/metal/http_authentication.rb:179:in
`authenticate' actionpack (3.2.8)
lib/action_controller/metal/http_authentication.rb:168:in
`authenticate_with_http_digest' actionpack (3.2.8)
lib/action_controller/metal/http_authentication.rb:163:in
`authenticate_or_request_with_http_digest'

其他输出(注意:我正在使用rvm并创建了一个项目gemset):

chadmiko [ ~/Documents/Projects/msa-web ]$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]
chadmiko [ ~/Documents/Projects/msa-web ]$ rails --version
Rails 3.2.8

另外,如果我启动irb:

chadmiko [ ~/Documents/Projects/msa-web ]$ irb
1.9.2-p290 :001 > require 'base64'
 => true 

感觉这里有一个简单的解决方案,但我只是错过了它。任何提示将不胜感激。感谢。

0 个答案:

没有答案