aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/lib/action_cable/server
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2016-02-05 22:48:48 +0100
committerKasper Timm Hansen <kaspth@gmail.com>2016-02-14 17:46:48 +0100
commit661298176c72eefc6d0f42b58210119e76962364 (patch)
tree521b31e85b607dff781a3ad40ae43bdf52022f8b /actioncable/lib/action_cable/server
parentf611e59cb16677156c231aa6328f7e7d47da2a28 (diff)
downloadrails-661298176c72eefc6d0f42b58210119e76962364.tar.gz
rails-661298176c72eefc6d0f42b58210119e76962364.tar.bz2
rails-661298176c72eefc6d0f42b58210119e76962364.zip
Inject Rails' channel paths in engine.
We were explicitly referencing Rails.root in ActionCable::Server::Configuration.initialize, thereby coupling ourselves to Rails. Instead add `app/channels` to Rails' app paths and assign the existent files to `channel_paths`. Users can still append to those load paths with `<<` and `push` in `config/application.rb`. This means we can remove the custom `Dir` lookup in `channel_paths` and the Rails and root definitions in the tests.
Diffstat (limited to 'actioncable/lib/action_cable/server')
-rw-r--r--actioncable/lib/action_cable/server/configuration.rb11
1 files changed, 2 insertions, 9 deletions
diff --git a/actioncable/lib/action_cable/server/configuration.rb b/actioncable/lib/action_cable/server/configuration.rb
index 9a248933c4..019a374734 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')]
-
@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