mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Use underscored class name as the default channel name
This commit is contained in:
parent
61ea867f29
commit
955bf93549
2 changed files with 5 additions and 1 deletions
|
@ -15,6 +15,10 @@ module ActionCable
|
||||||
def matches?(identifier)
|
def matches?(identifier)
|
||||||
raise "Please implement #{name}#matches? method"
|
raise "Please implement #{name}#matches? method"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def find_name
|
||||||
|
@name ||= channel_name || to_s.demodulize.underscore
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(connection, channel_identifier, params = {})
|
def initialize(connection, channel_identifier, params = {})
|
||||||
|
|
|
@ -49,7 +49,7 @@ module ActionCable
|
||||||
id_options = ActiveSupport::JSON.decode(id_key).with_indifferent_access
|
id_options = ActiveSupport::JSON.decode(id_key).with_indifferent_access
|
||||||
|
|
||||||
subscription_klass = registered_channels.detect do |channel_klass|
|
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
|
end
|
||||||
|
|
||||||
if subscription_klass
|
if subscription_klass
|
||||||
|
|
Loading…
Reference in a new issue