From 98ab4ded376c3d04540bdbdfe6dbbf88c0738701 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Mon, 23 Aug 2010 18:31:29 +0200 Subject: Set only helpers_path on inherited hook in action_controller/railtie.rb and use helper(:all) just after that --- actionpack/lib/action_controller/base.rb | 5 ----- actionpack/lib/action_controller/railtie.rb | 9 +++++++++ actionpack/lib/action_controller/railties/paths.rb | 6 ++---- 3 files changed, 11 insertions(+), 9 deletions(-) (limited to 'actionpack/lib/action_controller') diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 1953e1869f..b37bc02127 100644 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -221,11 +221,6 @@ module ActionController # Rails 2.x compatibility include ActionController::Compatibility - def self.inherited(klass) - super - klass.helper :all if klass.superclass == ActionController::Base - end - ActiveSupport.run_load_hooks(:action_controller, self) end end diff --git a/actionpack/lib/action_controller/railtie.rb b/actionpack/lib/action_controller/railtie.rb index 2271a51e4e..0cb4041855 100644 --- a/actionpack/lib/action_controller/railtie.rb +++ b/actionpack/lib/action_controller/railtie.rb @@ -42,10 +42,19 @@ module ActionController end initializer "action_controller.set_configs" do |app| + paths = app.config.paths + options = app.config.action_controller + + options.assets_dir ||= paths.public.to_a.first + options.javascripts_dir ||= paths.public.javascripts.to_a.first + options.stylesheets_dir ||= paths.public.stylesheets.to_a.first + options.page_cache_directory ||= paths.public.to_a.first + ActiveSupport.on_load(:action_controller) do include app.routes.mounted_helpers(:app) extend ::AbstractController::Railties::RoutesHelpers.with(app.routes) extend ::ActionController::Railties::Paths.with(app) + options.each { |k,v| send("#{k}=", v) } end end diff --git a/actionpack/lib/action_controller/railties/paths.rb b/actionpack/lib/action_controller/railties/paths.rb index 095beb7a2f..81d03f5e73 100644 --- a/actionpack/lib/action_controller/railties/paths.rb +++ b/actionpack/lib/action_controller/railties/paths.rb @@ -14,12 +14,10 @@ module ActionController paths = app.config.paths options = app.config.action_controller - options.assets_dir ||= paths.public.to_a.first - options.javascripts_dir ||= paths.public.javascripts.to_a.first - options.stylesheets_dir ||= paths.public.stylesheets.to_a.first - options.page_cache_directory ||= paths.public.to_a.first options.helpers_path ||= paths.app.helpers.to_a options.each { |k,v| klass.send("#{k}=", v) } + + klass.helper :all end end end -- cgit v1.2.3