From 51ad57989d3e2afb5b297edc7e6c997a41196559 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 16 Dec 2015 15:52:46 +0100 Subject: Doh, should have read ff370ee61754b00f864f3ddd0af62be4dfa0de67 Indeed we need this to be an engine for the internal assets to work --- actioncable/lib/action_cable/engine.rb | 36 +++++++++++++++++++++++++++++++++ actioncable/lib/action_cable/railtie.rb | 36 --------------------------------- 2 files changed, 36 insertions(+), 36 deletions(-) create mode 100644 actioncable/lib/action_cable/engine.rb delete mode 100644 actioncable/lib/action_cable/railtie.rb (limited to 'actioncable') diff --git a/actioncable/lib/action_cable/engine.rb b/actioncable/lib/action_cable/engine.rb new file mode 100644 index 0000000000..e62413e9e3 --- /dev/null +++ b/actioncable/lib/action_cable/engine.rb @@ -0,0 +1,36 @@ +require "rails" +require "action_cable" +require "action_cable/helpers/action_cable_helper" +require "active_support/core_ext/hash/indifferent_access" + +module ActionCable + class Railtie < Rails::Engine # :nodoc: + config.action_cable = ActiveSupport::OrderedOptions.new + config.eager_load_namespaces << ActionCable + + initializer "action_cable.helpers" do + ActiveSupport.on_load(:action_view) do + include ActionCable::Helpers::ActionCableHelper + end + end + + initializer "action_cable.logger" do + ActiveSupport.on_load(:action_cable) { self.logger ||= ::Rails.logger } + end + + initializer "action_cable.set_configs" do |app| + options = app.config.action_cable + options.allowed_request_origins ||= "http://localhost:3000" if ::Rails.env.development? + + app.paths.add "config/redis/cable", with: "config/redis/cable.yml" + + ActiveSupport.on_load(:action_cable) do + if redis_cable_path = app.config.paths["config/redis/cable"].existent + self.redis = Rails.application.config_for(Pathname.new(redis_cable_path.first)).with_indifferent_access + end + + options.each { |k,v| send("#{k}=", v) } + end + end + end +end diff --git a/actioncable/lib/action_cable/railtie.rb b/actioncable/lib/action_cable/railtie.rb deleted file mode 100644 index 7135b75d69..0000000000 --- a/actioncable/lib/action_cable/railtie.rb +++ /dev/null @@ -1,36 +0,0 @@ -require "rails" -require "action_cable" -require "action_cable/helpers/action_cable_helper" -require "active_support/core_ext/hash/indifferent_access" - -module ActionCable - class Railtie < Rails::Railtie # :nodoc: - config.action_cable = ActiveSupport::OrderedOptions.new - config.eager_load_namespaces << ActionCable - - initializer "action_cable.helpers" do - ActiveSupport.on_load(:action_view) do - include ActionCable::Helpers::ActionCableHelper - end - end - - initializer "action_cable.logger" do - ActiveSupport.on_load(:action_cable) { self.logger ||= ::Rails.logger } - end - - initializer "action_cable.set_configs" do |app| - options = app.config.action_cable - options.allowed_request_origins ||= "http://localhost:3000" if ::Rails.env.development? - - app.paths.add "config/redis/cable", with: "config/redis/cable.yml" - - ActiveSupport.on_load(:action_cable) do - if redis_cable_path = app.config.paths["config/redis/cable"].existent - self.redis = Rails.application.config_for(Pathname.new(redis_cable_path.first)).with_indifferent_access - end - - options.each { |k,v| send("#{k}=", v) } - end - end - end -end -- cgit v1.2.3