mirror of https://github.com/rails/rails
Add note about broadcast_to/broadcasting_for to change log
This commit is contained in:
parent
35bef64718
commit
513dd2cfdb
|
@ -1,3 +1,22 @@
|
||||||
|
* Add `Channel::Base#broadcast_to`.
|
||||||
|
|
||||||
|
You can now call `broadcast_to` within a channel action, which equals to
|
||||||
|
the `self.class.broadcast_to`.
|
||||||
|
|
||||||
|
*Vladimir Dementyev*
|
||||||
|
|
||||||
|
* Make `Channel::Base.broadcasting_for` a public API.
|
||||||
|
|
||||||
|
You can use `.broadcasting_for` to generate a unique stream identifier within
|
||||||
|
a channel for the specified target (e.g. Active Record model):
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
ChatChannel.broadcasting_for(model) # => "chat:<model.to_gid_param>"
|
||||||
|
```
|
||||||
|
|
||||||
|
*Vladimir Dementyev*
|
||||||
|
|
||||||
|
|
||||||
## Rails 6.0.0.beta1 (January 18, 2019) ##
|
## Rails 6.0.0.beta1 (January 18, 2019) ##
|
||||||
|
|
||||||
* Merge [`action-cable-testing`](https://github.com/palkan/action-cable-testing) to Rails.
|
* Merge [`action-cable-testing`](https://github.com/palkan/action-cable-testing) to Rails.
|
||||||
|
|
|
@ -15,7 +15,12 @@ module ActionCable
|
||||||
ActionCable.server.broadcast(broadcasting_for(model), message)
|
ActionCable.server.broadcast(broadcasting_for(model), message)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns a unique broadcasting identifier for this <tt>model</tt> in this channel.
|
# Returns a unique broadcasting identifier for this <tt>model</tt> 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.
|
||||||
def broadcasting_for(model)
|
def broadcasting_for(model)
|
||||||
serialize_broadcasting([ channel_name, model ])
|
serialize_broadcasting([ channel_name, model ])
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue