lib/action_cable/channel/naming.rb in actioncable-6.0.6.1 vs lib/action_cable/channel/naming.rb in actioncable-6.1.0.rc1
- old
+ new
@@ -12,10 +12,10 @@
#
# ChatChannel.channel_name # => 'chat'
# Chats::AppearancesChannel.channel_name # => 'chats:appearances'
# FooChats::BarAppearancesChannel.channel_name # => 'foo_chats:bar_appearances'
def channel_name
- @channel_name ||= name.sub(/Channel$/, "").gsub("::", ":").underscore
+ @channel_name ||= name.delete_suffix("Channel").gsub("::", ":").underscore
end
end
# Delegates to the class' <tt>channel_name</tt>
delegate :channel_name, to: :class