Loris Mazloum
Joined
1,420 Experience
14 Lessons Completed
0 Questions Solved
Activity
If I have multiple devise users scopes (Admin, User) and I plan to display the list of online Users and also the list of online Admins, should I generate 2 different channels, or should it be done in the same channel ? I am able to set the following:
identified_by :current_user, :current_admin
def connect
find_verified
end
protected
def find_verified
if (current_user = env["warden"].user(:user))
self.current_user = current_user
logger.add_tags "ActionCable", "User #{current_user.id}"
elsif (current_admin = env["warden"].user(:admin))
self.current_admin = current_admin
logger.add_tags "ActionCable", "Admin #{current_admin.id}"
else
reject_unauthorized_connection
end
end
But how should my online_channel.rb and js looks like ?
Posted in Rails view_components
+1