1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Use non-raising finder.

`find` raises when it can't find a record, so we'll never reach the
else. Switch to `find_by` which returns nil when no record can be
found.
This commit is contained in:
Kasper Timm Hansen 2017-05-27 14:36:18 +02:00
parent 3a131b6c00
commit fcc47bcfcc

View file

@ -31,7 +31,7 @@ module ActiveSupport
#
# private
# def authenticate
# if authenticated_user = User.find(cookies.signed[:user_id])
# if authenticated_user = User.find_by(id: cookies.signed[:user_id])
# Current.user = authenticated_user
# else
# redirect_to new_session_url