Skip to content

Instantly share code, notes, and snippets.

@KickButtowski80
Created December 25, 2017 23:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KickButtowski80/7b91cf7da4e42dffad72752cb007bc13 to your computer and use it in GitHub Desktop.
Save KickButtowski80/7b91cf7da4e42dffad72752cb007bc13 to your computer and use it in GitHub Desktop.
ActionCable Issues
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