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

[ci skip] Remove mentioning of the devise gem

This commit is contained in:
Zlatko Zahariev 2019-06-24 19:12:44 +03:00 committed by GitHub
parent 319b496882
commit 290d82ada0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -120,13 +120,9 @@ by this same current user, you're also ensuring that you can later retrieve all
connections by a given user (and potentially disconnect them all if the user is deleted connections by a given user (and potentially disconnect them all if the user is deleted
or unauthorized). or unauthorized).
If you use Devise for authenticaion, you can get `current_user` from warden: If your authentication approach includes using a session, you use cookie store for the
session, your session cookie is named `_session` and the user ID key is `user_id` you
```ruby can use this approach:
verified_user = env['warden'].user
```
In any other authentication approach you can access the session cookie. If you use cookie store for the session, your session cookie is named "\_session" and the user ID key is "user_id" you can use this approach:
```ruby ```ruby
verified_user = User.find_by(id: cookies.encrypted['_session']['user_id']) verified_user = User.find_by(id: cookies.encrypted['_session']['user_id'])
``` ```