Skip to content

Commit 2ab30a5

Browse files
authored
Merge pull request rails#41050 from alea12/update-actioncable-docs
Update ActionCable docs to be compatible with Ruby 3 [ci skip]
2 parents eeb3879 + 4858c9f commit 2ab30a5

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

actioncable/lib/action_cable/channel/streams.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module Channel
2525
#
2626
# An example broadcasting for this channel looks like so:
2727
#
28-
# ActionCable.server.broadcast "comments_for_45", author: 'DHH', content: 'Rails is just swell'
28+
# ActionCable.server.broadcast "comments_for_45", { author: 'DHH', content: 'Rails is just swell' }
2929
#
3030
# If you have a stream that is related to a model, then the broadcasting used can be generated from the model and channel.
3131
# The following example would subscribe to a broadcasting like <tt>comments:Z2lkOi8vVGVzdEFwcC9Qb3N0LzE</tt>.

guides/source/action_cable_overview.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ Then, elsewhere in your Rails application, you can broadcast to such a room by
326326
calling [`broadcast`][]:
327327

328328
```ruby
329-
ActionCable.server.broadcast("chat_Best Room", body: "This Room is Best Room.")
329+
ActionCable.server.broadcast("chat_Best Room", { body: "This Room is Best Room." })
330330
```
331331

332332
If you have a stream that is related to a model, then the broadcasting name
@@ -446,8 +446,10 @@ consumer.subscriptions.create({ channel: "ChatChannel", room: "Best Room" }, {
446446
# from a NewCommentJob.
447447
ActionCable.server.broadcast(
448448
"chat_#{room}",
449-
sent_by: 'Paul',
450-
body: 'This is a cool chat app.'
449+
{
450+
sent_by: 'Paul',
451+
body: 'This is a cool chat app.'
452+
}
451453
)
452454
```
453455

0 commit comments

Comments
 (0)