From c43c83984792ac546e7610c898cf9099cc1a2ee6 Mon Sep 17 00:00:00 2001 From: Vladimir Dementyev Date: Thu, 14 Feb 2019 13:59:10 -0500 Subject: feat: support channel_prefix in pg subscription adapter --- actioncable/CHANGELOG.md | 6 ++++++ actioncable/lib/action_cable/subscription_adapter/postgresql.rb | 2 ++ actioncable/test/subscription_adapter/postgresql_test.rb | 1 + 3 files changed, 9 insertions(+) (limited to 'actioncable') diff --git a/actioncable/CHANGELOG.md b/actioncable/CHANGELOG.md index 3ce35edbb8..600d4e130f 100644 --- a/actioncable/CHANGELOG.md +++ b/actioncable/CHANGELOG.md @@ -1,3 +1,9 @@ +* PostgreSQL subscription adapters now support `channel_prefix` option in cable.yml + + Avoids channel name collisions when multiple apps use the same database for Action Cable. + + *Vladimir Dementyev* + * Allow passing custom configuration to `ActionCable::Server::Base`. You can now create a standalone Action Cable server with a custom configuration diff --git a/actioncable/lib/action_cable/subscription_adapter/postgresql.rb b/actioncable/lib/action_cable/subscription_adapter/postgresql.rb index 50ec438c3a..1d60bed4af 100644 --- a/actioncable/lib/action_cable/subscription_adapter/postgresql.rb +++ b/actioncable/lib/action_cable/subscription_adapter/postgresql.rb @@ -8,6 +8,8 @@ require "digest/sha1" module ActionCable module SubscriptionAdapter class PostgreSQL < Base # :nodoc: + prepend ChannelPrefix + def initialize(*) super @listener = nil diff --git a/actioncable/test/subscription_adapter/postgresql_test.rb b/actioncable/test/subscription_adapter/postgresql_test.rb index 5fb26a8896..d262536d61 100644 --- a/actioncable/test/subscription_adapter/postgresql_test.rb +++ b/actioncable/test/subscription_adapter/postgresql_test.rb @@ -7,6 +7,7 @@ require "active_record" class PostgresqlAdapterTest < ActionCable::TestCase include CommonSubscriptionAdapterTest + include ChannelPrefixTest def setup database_config = { "adapter" => "postgresql", "database" => "activerecord_unittest" } -- cgit v1.2.3