새로운 Rails 5 (RC1) 앱을 만들고 있습니다. 사용자 인증을 위해 AuthLogic을 사용했으며, ActionCable에 들어갈 때까지 항상 작동합니다.AuthLogic이 ActionCable과 작동하도록하기
#app/channels/application_cable/connection.rb
module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :current_user
def connect
self.current_user = UserSession.find
end
end
end
나는 오류를 얻을 : 당신은 컨트롤러 객체에 Authlogic :: 세션 :: Base.controller를 활성화해야합니다 내가 노력
개체 만들기 전에 :
Authlogic::Session::Base.controller = Authlogic::ControllerAdapters::RailsAdapter.new(self)
하지만 그건하지 않습니다 Connection 클래스가 Controller가 아니기 때문에 작동합니다.
AuthLogic 코드를 살펴 보았지만 컨트롤러 개체에 대한 의존성을 무시하는 방법을 알 수 없습니다. 사용자 세션을로드하기 만하면됩니다. 이견있는 사람?
아주 좋은 솔루션을! 좋은 대답. 다음 라인을 편집하십시오 :'self.current_user = find_verified_user' :'self.current_user = find_verified_user_or_guest' – ZombieBsAs