Wednesday, February 23, 2011

Getting error: undefined method `to_key' for #

Rails 3 and Authlogic together giving error :
undefined method `to_key' for #<UserSession: no credentials provided>
To fix the error, change the code in user_session.rb as given below:

class UserSession < Authlogic::Session::Base

 def to_key
   new_record? ? nil : [ self.send(self.class.primary_key) ]

And it will work fine.
For details, you can refer to

1 comment: