aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actioncable/CHANGELOG.md6
-rw-r--r--actioncable/lib/action_cable/subscription_adapter/postgresql.rb2
-rw-r--r--actioncable/test/subscription_adapter/postgresql_test.rb1
3 files changed, 9 insertions, 0 deletions
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" }