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 /actionmailer/lib/action_mailer | |
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
Diffstat (limited to 'actionmailer/lib/action_mailer')
-rw-r--r-- | actionmailer/lib/action_mailer/railtie.rb | 9 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/railties/paths.rb | 26 |
2 files changed, 6 insertions, 29 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 |