aboutsummaryrefslogtreecommitdiffstats
path: root/lib/action_cable/channel
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2015-02-07 09:22:22 +0530
committerPratik Naik <pratiknaik@gmail.com>2015-02-07 09:22:22 +0530
commit85ac703585a3bc413571e23d2e7dc3ca1e4cad2e (patch)
tree9f33e2b71b12d5f6966ae2de2c505b9c7179f348 /lib/action_cable/channel
parent60173338ee0fb1667e226927e0034d50e3dd9d5a (diff)
downloadrails-85ac703585a3bc413571e23d2e7dc3ca1e4cad2e.tar.gz
rails-85ac703585a3bc413571e23d2e7dc3ca1e4cad2e.tar.bz2
rails-85ac703585a3bc413571e23d2e7dc3ca1e4cad2e.zip
Raise an exception when Server.pubsub class method is not defined
Diffstat (limited to 'lib/action_cable/channel')
-rw-r--r--lib/action_cable/channel/redis.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/action_cable/channel/redis.rb b/lib/action_cable/channel/redis.rb
index 00a8230a74..bdbd3c95b1 100644
--- a/lib/action_cable/channel/redis.rb
+++ b/lib/action_cable/channel/redis.rb
@@ -9,9 +9,10 @@ module ActionCable
end
def subscribe_to(redis_channel, callback = nil)
- @_redis_channels ||= []
+ raise "`ActionCable::Server.pubsub` class method is not defined" unless connection.class.respond_to?(:pubsub)
callback ||= -> (message) { broadcast ActiveSupport::JSON.decode(message) }
+ @_redis_channels ||= []
@_redis_channels << [ redis_channel, callback ]
pubsub.subscribe(redis_channel, &callback)
@@ -25,7 +26,7 @@ module ActionCable
end
def pubsub
- @connection.class.pubsub
+ connection.class.pubsub
end
end