From 3d4a423cdc6f365bb303b2827cc4890de8b1d28d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Mon, 14 Dec 2015 15:54:08 -0200 Subject: Hook in ActionView::Base, not in ApplicationController The application can have more than one ApplicationController and we want Action Cable helpers in all controllers and their views so we should hook in the same place that others helpers. --- actioncable/lib/action_cable/engine.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'actioncable') diff --git a/actioncable/lib/action_cable/engine.rb b/actioncable/lib/action_cable/engine.rb index 2cd13285e7..071dcd73e4 100644 --- a/actioncable/lib/action_cable/engine.rb +++ b/actioncable/lib/action_cable/engine.rb @@ -7,8 +7,10 @@ module ActionCable class Engine < ::Rails::Engine config.action_cable = ActiveSupport::OrderedOptions.new - config.to_prepare do - ApplicationController.helper ActionCable::Helpers::ActionCableHelper + initializer "action_cable.helpers" do + ActiveSupport.on_load(:action_view) do + include ActionCable::Helpers::ActionCableHelper + end end initializer "action_cable.logger" do -- cgit v1.2.3