diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2010-08-23 18:31:29 +0200 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2010-09-03 22:59:13 +0200 |
commit | 98ab4ded376c3d04540bdbdfe6dbbf88c0738701 (patch) | |
tree | 332af78016a4c9d5f5c682530af9449fc4d8f447 | |
parent | 8ec2175aee93ecfd928de67c0a125bccc5e1c152 (diff) | |
download | rails-98ab4ded376c3d04540bdbdfe6dbbf88c0738701.tar.gz rails-98ab4ded376c3d04540bdbdfe6dbbf88c0738701.tar.bz2 rails-98ab4ded376c3d04540bdbdfe6dbbf88c0738701.zip |
Set only helpers_path on inherited hook in action_controller/railtie.rb and use helper(:all) just after that
-rw-r--r-- | actionmailer/lib/action_mailer/railtie.rb | 9 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/railties/paths.rb | 26 | ||||
-rw-r--r-- | actionpack/lib/action_controller/base.rb | 5 | ||||
-rw-r--r-- | actionpack/lib/action_controller/railtie.rb | 9 | ||||
-rw-r--r-- | actionpack/lib/action_controller/railties/paths.rb | 6 |
5 files changed, 17 insertions, 38 deletions
diff --git a/actionmailer/lib/action_mailer/railtie.rb b/actionmailer/lib/action_mailer/railtie.rb index 3c1f045e79..a2b00addc9 100644 --- a/actionmailer/lib/action_mailer/railtie.rb +++ b/actionmailer/lib/action_mailer/railtie.rb @@ -1,7 +1,6 @@ require "action_mailer" require "rails" require "abstract_controller/railties/routes_helpers" -require "action_mailer/railties/paths" module ActionMailer class Railtie < Rails::Railtie @@ -12,13 +11,17 @@ module ActionMailer end initializer "action_mailer.set_configs" do |app| + paths = app.config.paths options = app.config.action_mailer + 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 + ActiveSupport.on_load(:action_mailer) do include AbstractController::UrlFor - include app.routes.mounted_helpers(:app) extend ::AbstractController::Railties::RoutesHelpers.with(app.routes) - extend ::ActionMailer::Railties::Paths.with(app) + include app.routes.mounted_helpers(:app) options.each { |k,v| send("#{k}=", v) } end end diff --git a/actionmailer/lib/action_mailer/railties/paths.rb b/actionmailer/lib/action_mailer/railties/paths.rb deleted file mode 100644 index fa9188be77..0000000000 --- a/actionmailer/lib/action_mailer/railties/paths.rb +++ /dev/null @@ -1,26 +0,0 @@ -module ActionMailer - module Railties - module Paths - def self.with(_app) - Module.new do - define_method(:inherited) do |klass| - super(klass) - if namespace = klass.parents.detect {|m| m.respond_to?(:_railtie) } - app = namespace._railtie - else - app = _app - end - - paths = app.config.paths - options = app.config.action_mailer - - 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.each { |k,v| klass.send("#{k}=", v) } - end - end - end - end - end -end 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 |