浏览代码

Fix 404 on session gone

Maarten van den Berg 7 年之前
父节点
当前提交
841821dbc4
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      app/helpers/authentication_helper.rb

+ 1 - 1
app/helpers/authentication_helper.rb

99
       @user_session
99
       @user_session
100
     else
100
     else
101
       id = cookies.signed.permanent[:session_id] || session[:session_id]
101
       id = cookies.signed.permanent[:session_id] || session[:session_id]
102
-      @user_session ||= Session.find(id)
102
+      @user_session ||= Session.find_by(id: id)
103
     end
103
     end
104
 
104
 
105
     # Edge case if a session no longer exists in the database
105
     # Edge case if a session no longer exists in the database