instance method channel_name

Ruby on Rails 5.1.7

Since v5.0.7.2

Available in: v5.0.7.2 v5.1.7 v7.2.3.2 v8.0.5.1 v8.1.3.1 edge

Signature

channel_name()

Returns the name of the channel, underscored, without the Channel ending. If the channel is in a namespace, then the namespaces are represented by single colon separators in the channel name.

ChatChannel.channel_name # => 'chat'
Chats::AppearancesChannel.channel_name # => 'chats:appearances'
FooChats::BarAppearancesChannel.channel_name # => 'foo_chats:bar_appearances'
Source
# File actioncable/lib/action_cable/channel/naming.rb, line 14
        def channel_name
          @channel_name ||= name.sub(/Channel$/, "").gsub("::", ":").underscore
        end

Defined in actioncable/lib/action_cable/channel/naming.rb line 14 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionCable::Channel::Naming

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close