You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ActionCable.server.broadcast raises ArgumentError in Ruby 3.0.0 when the message parameter is passed traditionally without using hashes, making the documented code in Rails Guides inoperative.
However, passing messages to ActionCable.server.broadcast without using the hash is common usage, which is also documented in Action Cable Overview — Ruby on Rails Guides. I think we should consider updating the guide or the source code. If we need a patch to the guide, I'd be ready to submit one :)
The text was updated successfully, but these errors were encountered:
ActionCable.server.broadcastraisesArgumentErrorin Ruby 3.0.0 when themessageparameter is passed traditionally without using hashes, making the documented code in Rails Guides inoperative.Steps to reproduce
In rails console:
Expected behavior
I've confirmed the following behavior in Ruby 2.7.2:
Actual behavior
ArgumentErrorSystem configuration
Rails version: Rails 6.1.0
Ruby version: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20]
Workaround & The root cause
Passing the message argument as a hash is a workaround:
Positional arguments and keyword arguments were separated in Ruby 3.0.0, and that is affecting
ActionCable.server.broadcastwhen passing arguments.rails/actioncable/lib/action_cable/server/broadcasting.rb
Lines 24 to 26 in afc79e3
However, passing messages to
ActionCable.server.broadcastwithout using the hash is common usage, which is also documented in Action Cable Overview — Ruby on Rails Guides. I think we should consider updating the guide or the source code. If we need a patch to the guide, I'd be ready to submit one :)The text was updated successfully, but these errors were encountered: