From 91656aed59d45893383c99d068f42774a22ac254 Mon Sep 17 00:00:00 2001 From: Sergey Novikov Date: Fri, 22 Jan 2016 16:52:12 +0300 Subject: Allow adding custom paths for action_cable channels --- actioncable/lib/action_cable/server/configuration.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/actioncable/lib/action_cable/server/configuration.rb b/actioncable/lib/action_cable/server/configuration.rb index ebbf60c6e2..236096fb5f 100644 --- a/actioncable/lib/action_cable/server/configuration.rb +++ b/actioncable/lib/action_cable/server/configuration.rb @@ -15,13 +15,15 @@ module ActionCable @connection_class = ApplicationCable::Connection @worker_pool_size = 100 - @channels_path = Rails.root.join('app/channels') + @channels_path = [Rails.root.join('app/channels')] @disable_request_forgery_protection = false end def channel_paths - @channels ||= Dir["#{channels_path}/**/*_channel.rb"] + @channels ||= channels_path.collect do |channel_path| + Dir["#{channel_path}/**/*_channel.rb"] + end.flatten end def channel_class_names -- cgit v1.2.3 From a17f7a0bc12d1d2a4cbc8dfa62d3bcb94ed48c45 Mon Sep 17 00:00:00 2001 From: Sergey Novikov Date: Sat, 23 Jan 2016 02:50:03 +0300 Subject: Rename channels_path var and fix channel_paths method for ActionCable config --- actioncable/lib/action_cable/server/configuration.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/actioncable/lib/action_cable/server/configuration.rb b/actioncable/lib/action_cable/server/configuration.rb index 236096fb5f..9a248933c4 100644 --- a/actioncable/lib/action_cable/server/configuration.rb +++ b/actioncable/lib/action_cable/server/configuration.rb @@ -5,7 +5,7 @@ module ActionCable class Configuration attr_accessor :logger, :log_tags attr_accessor :connection_class, :worker_pool_size - attr_accessor :channels_path + attr_accessor :channel_load_paths attr_accessor :disable_request_forgery_protection, :allowed_request_origins attr_accessor :cable, :url @@ -15,15 +15,15 @@ module ActionCable @connection_class = ApplicationCable::Connection @worker_pool_size = 100 - @channels_path = [Rails.root.join('app/channels')] + @channel_load_paths = [Rails.root.join('app/channels')] @disable_request_forgery_protection = false end def channel_paths - @channels ||= channels_path.collect do |channel_path| - Dir["#{channel_path}/**/*_channel.rb"] - end.flatten + @channel_paths ||= channel_load_paths.flat_map do |path| + Dir["#{path}/**/*_channel.rb"] + end end def channel_class_names -- cgit v1.2.3