Created
December 25, 2017 23:08
-
-
Save KickButtowski80/7b91cf7da4e42dffad72752cb007bc13 to your computer and use it in GitHub Desktop.
ActionCable Issues
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ApplicationCable | |
class Connection < ActionCable::Connection::Base | |
identified_by :current_admin | |
def connect | |
self.current_admin = find_verified_admin | |
logger.add_tags 'ActionCable', current_admin.email | |
end | |
protected | |
def find_verified_admin # this checks whether a admin is authenticated with devise | |
if verified_admin = env['warden'].admin | |
verified_admin | |
else | |
reject_unauthorized_connection | |
end | |
end | |
end | |
end | |
the error is | |
There was an exception - NoMethodError(undefined method `admin' for #<Warden::Proxy:0x00000005c99eb0>) | |
/home/ubuntu/workspace/blog/app/channels/application_cable/connection.rb:13:in `find_verified_admin' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment