lib/twitter_auth/controller_extensions.rb in mbleigh-twitter-auth-0.1.8 vs lib/twitter_auth/controller_extensions.rb in mbleigh-twitter-auth-0.1.10
- old
+ new
@@ -18,11 +18,11 @@
flash[:notice] = message
redirect_to destination
end
def current_user
- @current_user ||= User.find_by_id(session[:user_id])
+ @current_user ||= User.find_by_id(session[:user_id]) || User.from_remember_token(cookies[:remember_token])
end
def current_user=(new_user)
session[:user_id] = new_user.id
@current_user = new_user
@@ -55,9 +55,10 @@
end
def logout_keeping_session!
@current_user = nil
session[:user_id] = nil
+ cookies.delete(:remember_token)
end
end
end
ActionController::Base.send(:include, TwitterAuth::ControllerExtensions)