I am almost completely new to Rails, or I am sure I would know how to answer this question myself. I am just trying to modify the basic chat app created in the basic ActionCable demo: https://medium.com/@dhh/rails-5-action-cable-demo-8bba4ccfc55e#.6lmd6tfi7
Instead of having just one chat room, I want to have multiple chat rooms, so I modified my routes.rb by adding this line:
get '/rooms/show/:topic', to: 'rooms#show'
So now I can visit different chat rooms based on different topics. The rooms controller at /app/controllers/rooms_controller.rb handles these routes with no problem:
class RoomsController < ApplicationController
def show
@topic = params[:topic]
@messages = Message.all
end
end
But this parameter is not being passed to app/channels/room_channel.rb, and I'm just not sure what modifications I need to make. My current attempt:
class RoomChannel < ApplicationCable::Channel
def subscribed
stream_from "room_channel_#{params[:topic]}"
end
only returns "room_channel_"