Skip to content

Commit

Permalink
Merge pull request #41050 from alea12/update-actioncable-docs
Browse files Browse the repository at this point in the history
Update ActionCable docs to be compatible with Ruby 3 [ci skip]
  • Loading branch information
eileencodes committed Jan 8, 2021
1 parent 67fd5cb commit 9f68683
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion actioncable/lib/action_cable/channel/streams.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module Channel
#
# An example broadcasting for this channel looks like so:
#
# ActionCable.server.broadcast "comments_for_45", author: 'DHH', content: 'Rails is just swell'
# ActionCable.server.broadcast "comments_for_45", { author: 'DHH', content: 'Rails is just swell' }
#
# If you have a stream that is related to a model, then the broadcasting used can be generated from the model and channel.
# The following example would subscribe to a broadcasting like <tt>comments:Z2lkOi8vVGVzdEFwcC9Qb3N0LzE</tt>.
Expand Down
8 changes: 5 additions & 3 deletions guides/source/action_cable_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ Then, elsewhere in your Rails application, you can broadcast to such a room by
calling [`broadcast`][]:

```ruby
ActionCable.server.broadcast("chat_Best Room", body: "This Room is Best Room.")
ActionCable.server.broadcast("chat_Best Room", { body: "This Room is Best Room." })
```

If you have a stream that is related to a model, then the broadcasting name
Expand Down Expand Up @@ -446,8 +446,10 @@ consumer.subscriptions.create({ channel: "ChatChannel", room: "Best Room" }, {
# from a NewCommentJob.
ActionCable.server.broadcast(
"chat_#{room}",
sent_by: 'Paul',
body: 'This is a cool chat app.'
{
sent_by: 'Paul',
body: 'This is a cool chat app.'
}
)
```

Expand Down

0 comments on commit 9f68683

Please sign in to comment.