Open yebihara opened 14 years ago
My environment: ruby 1.8.7 + Rails 2.3.8
I met the following error when a session kept in cookie is recovered.
F, [2010-08-03T19:40:02.937000 #2624] FATAL -- : NoMethodError (undefined method remember_token?' for true:TrueClass): lib/authenticated_system.rb:130:inlogin_from_cookie' lib/authenticated_system.rb:12:in current_user' lib/authenticated_system.rb:6:inlogged_in?' lib/authenticated_system.rb:35:in authorized?' lib/authenticated_system.rb:53:inlogin_required'
remember_token?' for true:TrueClass): lib/authenticated_system.rb:130:in
current_user' lib/authenticated_system.rb:6:in
authorized?' lib/authenticated_system.rb:53:in
The error occurs because "true" is set to "user" variable in the following block in lib/authenticated_system.rb.
def login_from_cookie user = !cookies[:auth_token].blank? and User.find_by_remember_token(cookies[:auth_token]) if user && user.remember_token?
The error disappeared after I replaced 'and' with '&&' as follows.
user = !cookies[:auth_token].blank? && User.find_by_remember_token(cookies[:auth_token])
This may depend on ruby version or something.
Thanks,
ebi
My environment: ruby 1.8.7 + Rails 2.3.8
I met the following error when a session kept in cookie is recovered.
F, [2010-08-03T19:40:02.937000 #2624] FATAL -- : NoMethodError (undefined method
remember_token?' for true:TrueClass): lib/authenticated_system.rb:130:in
login_from_cookie' lib/authenticated_system.rb:12:incurrent_user' lib/authenticated_system.rb:6:in
logged_in?' lib/authenticated_system.rb:35:inauthorized?' lib/authenticated_system.rb:53:in
login_required'The error occurs because "true" is set to "user" variable in the following block in lib/authenticated_system.rb.
The error disappeared after I replaced 'and' with '&&' as follows.
This may depend on ruby version or something.
Thanks,
ebi