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:
parent
3a131b6c00
commit
fcc47bcfcc
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue