ActionCable and Devise - how to get the current_user

55 views
Skip to first unread message

Cyril Lavedrine

unread,
Jan 16, 2016, 4:43:41 PM1/16/16
to rubyonra...@googlegroups.com
Hello,

I've followed DHH's ActionCable chat demo (https://medium.com/@dhh/rails-5-action-cable-demo-8bba4ccfc55e#.720wf5ko0), and it works perfectly with this simple setup.

So logically the next step is adding user registration to the app and writing the user name in front of the message that has been posted.

Once I add a User model and Devise to my application, I get a bit lost. What I'd like to accomplish is having a user log through the Devise users/sign_in page, and identifying the "current_user" inside the MessageBroadcastJob.

I've already tried an uglier way (transmitting user.id through a cookie) but the valued is encrypted.

What would be the best way to get this information ?

Thanks for your help !
Cyril
Reply all
Reply to author
Forward
0 new messages