Skip to content
Browse files

set session user_id after login from cookies.

  • Loading branch information...
1 parent 4e82c16 commit 3745c3fd3092aba3d6cd67c8efa3db1cb60f8db3 @chloerei committed Nov 25, 2012
Showing with 7 additions and 3 deletions.
  1. +7 −3 app/controllers/application_controller.rb
View
10 app/controllers/application_controller.rb
@@ -67,9 +67,13 @@ def login_from_session
def login_from_cookies
if cookies[:remember_token].present?
- user = User.find_by_remember_token cookies[:remember_token]
- forget_me unless user
- user
+ if user = User.find_by_remember_token(cookies[:remember_token])
+ session[:user_id] = user.id
+ user
+ else
+ forget_me
+ nil
+ end
end
end

0 comments on commit 3745c3f

Please sign in to comment.
Something went wrong with that request. Please try again.