diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2017-05-27 14:36:18 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2017-05-27 14:36:18 +0200 |
commit | fcc47bcfccc7578aa0414710eecdad006085a911 (patch) | |
tree | d09cad16eed4c367ddd809a9699da265ca821830 /activesupport/lib/active_support | |
parent | 3a131b6c008eed58fddfa23f2787d9eef657331a (diff) | |
download | rails-fcc47bcfccc7578aa0414710eecdad006085a911.tar.gz rails-fcc47bcfccc7578aa0414710eecdad006085a911.tar.bz2 rails-fcc47bcfccc7578aa0414710eecdad006085a911.zip |
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.
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/current_attributes.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/current_attributes.rb b/activesupport/lib/active_support/current_attributes.rb index 2251f56aef..9921241c23 100644 --- a/activesupport/lib/active_support/current_attributes.rb +++ b/activesupport/lib/active_support/current_attributes.rb @@ -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 |