I'm migrating a working app to a new server, but all my authentication tests are failing on SHA2. The user.rb model has require 'digest/ sha2' at the top, yet I still get this error... NameError: uninitialized constant Digest::SHA2 Any ideas how to resolve this issue? I've been searching Google for a day and haven't found anything. Here is some more info on my new setup (running Debian etch)... # ruby -v ruby 1.8.5 (2006-08-25) [i486-linux] # rails -v Rails 2.2.2 # gem -v 1.3.1 # gem list --local *** LOCAL GEMS *** actionmailer (2.2.2, 2.0.2) actionpack (2.2.2, 2.0.2) activerecord (2.2.2, 2.0.2) activeresource (2.2.2, 2.0.2) activesupport (2.2.2, 2.0.2) cgi_multipart_eof_fix (2.5.0) daemons (1.0.10) fastthread (1.0.1) gem_plugin (0.2.3) hoe (1.8.2) jruby-openssl (0.3) memcache-client (1.5.0) mongrel (1.1.5) mongrel_cluster (1.0.5) rails (2.2.2, 2.0.2) rake (0.8.3) ruby-openid (2.1.2) rubyforge (1.0.1) youtube-g (0.4.9.9) ZenTest (3.11.0)
on 2008-12-27 17:44
on 2008-12-27 21:08
Ouch - I simply used Digest::SHA256 instead of Digest::SHA2 and it works now.
on 2008-12-29 12:28
Just try the echo statement and check what it is printing in the model.May be the sha1 will be using Time.now function also in addtion to its own coding.The time that value is authenticated and the time when u are checking the authentication will be different The solution is if the sha1 is encoded with time also just remove the Time.now function from it.Then this will solve the issue.i have also faced the similar problem when i used acts_as_authenticated plugin.