Я хочу получить доступ к моему методу current_user, который определен в SessionsHelper. Как я могу включить или потребовать его для класса подключения ApplicationCable?
module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :current_user
def connect
if current_user
self.current_user = current_user
logger.add_tags current_user.name
end
end
end
end
дает мне
There was an exception - NoMethodError(undefined method `name' for nil:NilClass)
Эквивалент ApplicationController. Я включил SessionHelper в каналы / application_cable / connection.rb
module ApplicationCable
class Connection < ActionCable::Connection::Base
include SessionsHelper
identified_by :current_user
# (..)
end
end
но не работает.