diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2016-02-14 18:08:46 +0100 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2016-02-14 18:08:46 +0100 |
commit | 3c96a6eaa42873147d4be4c753981b7e99a2ba4f (patch) | |
tree | 5831bddc71ea351d2a5f946218b5977634f958ff /actioncable/lib/action_cable | |
parent | 6f8f2a2017e09d8d94c70761c70007ce72b984e7 (diff) | |
parent | 3ae8eb13cb4967f533339ecddf93e19f06caa6d2 (diff) | |
download | rails-3c96a6eaa42873147d4be4c753981b7e99a2ba4f.tar.gz rails-3c96a6eaa42873147d4be4c753981b7e99a2ba4f.tar.bz2 rails-3c96a6eaa42873147d4be4c753981b7e99a2ba4f.zip |
Merge pull request #23505 from kaspth/inject-rails-config-through-railtie
Inject Rails related configuration through Railtie
Diffstat (limited to 'actioncable/lib/action_cable')
-rw-r--r-- | actioncable/lib/action_cable/engine.rb | 6 | ||||
-rw-r--r-- | actioncable/lib/action_cable/server/configuration.rb | 15 |
2 files changed, 10 insertions, 11 deletions
diff --git a/actioncable/lib/action_cable/engine.rb b/actioncable/lib/action_cable/engine.rb index f5e233e091..f5f1cb59e0 100644 --- a/actioncable/lib/action_cable/engine.rb +++ b/actioncable/lib/action_cable/engine.rb @@ -31,6 +31,12 @@ module ActionCable self.cable = Rails.application.config_for(config_path).with_indifferent_access end + if 'ApplicationCable::Connection'.safe_constantize + self.connection_class = ApplicationCable::Connection + end + + self.channel_paths = Rails.application.paths['app/channels'].existent + options.each { |k,v| send("#{k}=", v) } end end diff --git a/actioncable/lib/action_cable/server/configuration.rb b/actioncable/lib/action_cable/server/configuration.rb index 9a248933c4..58bb8ff65a 100644 --- a/actioncable/lib/action_cable/server/configuration.rb +++ b/actioncable/lib/action_cable/server/configuration.rb @@ -5,27 +5,20 @@ module ActionCable class Configuration attr_accessor :logger, :log_tags attr_accessor :connection_class, :worker_pool_size - attr_accessor :channel_load_paths attr_accessor :disable_request_forgery_protection, :allowed_request_origins attr_accessor :cable, :url + attr_accessor :channel_paths # :nodoc: + def initialize @log_tags = [] - @connection_class = ApplicationCable::Connection - @worker_pool_size = 100 - - @channel_load_paths = [Rails.root.join('app/channels')] + @connection_class = ActionCable::Connection::Base + @worker_pool_size = 100 @disable_request_forgery_protection = false end - def channel_paths - @channel_paths ||= channel_load_paths.flat_map do |path| - Dir["#{path}/**/*_channel.rb"] - end - end - def channel_class_names @channel_class_names ||= channel_paths.collect do |channel_path| Pathname.new(channel_path).basename.to_s.split('.').first.camelize |