ActionCable and Devise - how to get the current_user

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs