diff options
Diffstat (limited to 'actioncable/lib/action_cable')
-rw-r--r-- | actioncable/lib/action_cable/storage_adapter.rb | 2 | ||||
-rw-r--r-- | actioncable/lib/action_cable/storage_adapter/postgresql.rb (renamed from actioncable/lib/action_cable/storage_adapter/postgres.rb) | 8 | ||||
-rw-r--r-- | actioncable/lib/action_cable/storage_adapter/redis.rb | 8 |
3 files changed, 14 insertions, 4 deletions
diff --git a/actioncable/lib/action_cable/storage_adapter.rb b/actioncable/lib/action_cable/storage_adapter.rb index f1c395eb3a..a4fe12c770 100644 --- a/actioncable/lib/action_cable/storage_adapter.rb +++ b/actioncable/lib/action_cable/storage_adapter.rb @@ -1,7 +1,7 @@ module ActionCable module StorageAdapter autoload :Base, 'action_cable/storage_adapter/base' - autoload :Postgres, 'action_cable/storage_adapter/postgres' + autoload :PostgreSQL, 'action_cable/storage_adapter/postgresql' autoload :Redis, 'action_cable/storage_adapter/redis' end end diff --git a/actioncable/lib/action_cable/storage_adapter/postgres.rb b/actioncable/lib/action_cable/storage_adapter/postgresql.rb index 5d874533be..1d8460e2ea 100644 --- a/actioncable/lib/action_cable/storage_adapter/postgres.rb +++ b/actioncable/lib/action_cable/storage_adapter/postgresql.rb @@ -1,8 +1,14 @@ require 'thread' +begin + require 'pg' +rescue Gem::LoadError => e + raise Gem::LoadError, "You are trying to use the PostgreSQL ActionCable adapter, but do not have the proper gems installed. Add `gem 'pg'` to your Gemfile (and ensure its version is at the minimum required by ActionCable)." +end + module ActionCable module StorageAdapter - class Postgres < Base + class PostgreSQL < Base # The storage instance used for broadcasting. Not intended for direct user use. def broadcast(channel, payload) with_connection do |pg_conn| diff --git a/actioncable/lib/action_cable/storage_adapter/redis.rb b/actioncable/lib/action_cable/storage_adapter/redis.rb index 3e0ede057a..62a3971ec7 100644 --- a/actioncable/lib/action_cable/storage_adapter/redis.rb +++ b/actioncable/lib/action_cable/storage_adapter/redis.rb @@ -1,5 +1,9 @@ -require 'em-hiredis' -require 'redis' +begin + require 'em-hiredis' + require 'redis' +rescue Gem::LoadError => e + raise Gem::LoadError, "You are trying to use the Redis ActionCable adapter, but do not have the proper gems installed. Add `gem 'em-hiredis'` and `gem 'redis'` to your Gemfile (and ensure its version is at the minimum required by ActionCable)." +end module ActionCable module StorageAdapter |