diff options
author | Xavier Noria <fxn@hashref.com> | 2019-02-11 12:44:25 -0800 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2019-02-12 02:28:04 -0800 |
commit | 821d6c694cd305b7792b96d6ebc1c15ca235cf3e (patch) | |
tree | cb72d427f1744ad5a5c7dc901cb53db63c94a591 /actionmailer/lib | |
parent | ad3cbc2452e8150542ecb539925396361f12534c (diff) | |
download | rails-821d6c694cd305b7792b96d6ebc1c15ca235cf3e.tar.gz rails-821d6c694cd305b7792b96d6ebc1c15ca235cf3e.tar.bz2 rails-821d6c694cd305b7792b96d6ebc1c15ca235cf3e.zip |
Zeitwerk integration
Diffstat (limited to 'actionmailer/lib')
-rw-r--r-- | actionmailer/lib/action_mailer/railtie.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/actionmailer/lib/action_mailer/railtie.rb b/actionmailer/lib/action_mailer/railtie.rb index 23488db790..893a4a25b1 100644 --- a/actionmailer/lib/action_mailer/railtie.rb +++ b/actionmailer/lib/action_mailer/railtie.rb @@ -59,6 +59,14 @@ module ActionMailer end end + initializer "action_mailer.set_autoload_paths" do |app| + options = app.config.action_mailer + + if options.show_previews && options.preview_path + ActiveSupport::Dependencies.autoload_paths << options.preview_path + end + end + initializer "action_mailer.compile_config_methods" do ActiveSupport.on_load(:action_mailer) do config.compile_methods! if config.respond_to?(:compile_methods!) @@ -76,12 +84,8 @@ module ActionMailer if options.show_previews app.routes.prepend do - get "/rails/mailers" => "rails/mailers#index", internal: true - get "/rails/mailers/*path" => "rails/mailers#preview", internal: true - end - - if options.preview_path - ActiveSupport::Dependencies.autoload_paths << options.preview_path + get "/rails/mailers" => "rails/mailers#index", internal: true + get "/rails/mailers/*path" => "rails/mailers#preview", internal: true end end end |