Method: ActionCable::Channel::Broadcasting::ClassMethods#broadcasting_for

Defined in:
lib/action_cable/channel/broadcasting.rb

#broadcasting_for(model) ⇒ Object

Returns a unique broadcasting identifier for this model in this channel:

CommentsChannel.broadcasting_for("all") # => "comments:all"

You can pass any object as a target (e.g. Active Record model), and it would be serialized into a string under the hood.



24
25
26
# File 'lib/action_cable/channel/broadcasting.rb', line 24

def broadcasting_for(model)
  serialize_broadcasting([ channel_name, model ])
end