Skip to content

Commit 07f3fe4

Browse files
princejosephclaude
andcommitted
Fix Ruby 3 keyword arg issue in ActionCable broadcast
In Ruby 3, bare `key: val` syntax is always treated as keyword arguments. `ActionCable::Server::Broadcasting#broadcast` expects its second argument (`message`) as a positional parameter, not a keyword. The call: ActionCable.server.broadcast(channel, message: x, data: y) silently raised `ArgumentError: wrong number of arguments (given 1, expected 2)` in Ruby 3, which was rescued by the controller — causing all ActionCable broadcasts to silently fail (no real-time updates to other connected clients). Fix: wrap the hash in explicit braces so Ruby passes it as a positional arg. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5ce02b2 commit 07f3fe4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

ruby/hyper-operation/lib/hyper-operation/transport/hyperstack.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def self.send_data(channel, data)
127127
elsif transport == :pusher
128128
pusher.trigger("#{Hyperstack.channel}-#{data[1][:channel].gsub('::', '==')}", *data)
129129
elsif transport == :action_cable
130-
ActionCable.server.broadcast("hyperstack-#{channel}", message: data[0], data: data[1])
130+
ActionCable.server.broadcast("hyperstack-#{channel}", { message: data[0], data: data[1] })
131131
end
132132
end
133133

0 commit comments

Comments
 (0)