diff options
-rw-r--r-- | lib/action_cable/channel/base.rb | 4 | ||||
-rw-r--r-- | lib/action_cable/server.rb | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/action_cable/channel/base.rb b/lib/action_cable/channel/base.rb index 1ede07d9e3..6eaade4c8f 100644 --- a/lib/action_cable/channel/base.rb +++ b/lib/action_cable/channel/base.rb @@ -15,6 +15,10 @@ module ActionCable def matches?(identifier) raise "Please implement #{name}#matches? method" end + + def find_name + @name ||= channel_name || to_s.demodulize.underscore + end end def initialize(connection, channel_identifier, params = {}) diff --git a/lib/action_cable/server.rb b/lib/action_cable/server.rb index 08a6e9030b..eeeb50f08c 100644 --- a/lib/action_cable/server.rb +++ b/lib/action_cable/server.rb @@ -49,7 +49,7 @@ module ActionCable id_options = ActiveSupport::JSON.decode(id_key).with_indifferent_access subscription_klass = registered_channels.detect do |channel_klass| - channel_klass.channel_name == id_options[:channel] && channel_klass.matches?(id_options) + channel_klass.find_name == id_options[:channel] && channel_klass.matches?(id_options) end if subscription_klass |