From 4565b13b8ebdb365a70a4b344c59cd71781c2657 Mon Sep 17 00:00:00 2001 From: Miklos Fazekas Date: Sat, 2 Mar 2019 13:58:27 +0100 Subject: [PATCH 1/2] Fix rails 6 parent_name deprecation warning --- lib/email_prefixer/railtie.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/email_prefixer/railtie.rb b/lib/email_prefixer/railtie.rb index b4fc0bb..5e5ce5c 100644 --- a/lib/email_prefixer/railtie.rb +++ b/lib/email_prefixer/railtie.rb @@ -2,7 +2,11 @@ module EmailPrefixer class Railtie < ::Rails::Railtie initializer 'email_prefixer.configure_defaults' do |app| config = EmailPrefixer.configure do |config| - config.application_name ||= app.class.parent_name + config.application_name ||= if app.class.respond_to?(:module_parent_name) + app.class.module_parent_name + else + app.class.parent_name + end config.stage_name ||= Rails.env config.builder ||= EmailPrefixer::Configuration::DEFAULT_BUILDER end From e52f91a682ae23f163ece3fa31477e9212d33df4 Mon Sep 17 00:00:00 2001 From: Junichi Ito Date: Thu, 18 Feb 2021 08:15:32 +0900 Subject: [PATCH 2/2] Load action_mailer lazily Fixes deprecation notice https://github.com/rails/rails/issues/36546 --- lib/email_prefixer/railtie.rb | 6 ++++-- spec/dummy/app/assets/config/manifest.js | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 spec/dummy/app/assets/config/manifest.js diff --git a/lib/email_prefixer/railtie.rb b/lib/email_prefixer/railtie.rb index 5e5ce5c..447cfc3 100644 --- a/lib/email_prefixer/railtie.rb +++ b/lib/email_prefixer/railtie.rb @@ -11,8 +11,10 @@ class Railtie < ::Rails::Railtie config.builder ||= EmailPrefixer::Configuration::DEFAULT_BUILDER end interceptor = EmailPrefixer::Interceptor.new(config) - ActionMailer::Base.register_preview_interceptor(interceptor) - ActionMailer::Base.register_interceptor(interceptor) + ActiveSupport.on_load :action_mailer do + register_preview_interceptor(interceptor) + register_interceptor(interceptor) + end end end end diff --git a/spec/dummy/app/assets/config/manifest.js b/spec/dummy/app/assets/config/manifest.js new file mode 100644 index 0000000..b16e53d --- /dev/null +++ b/spec/dummy/app/assets/config/manifest.js @@ -0,0 +1,3 @@ +//= link_tree ../images +//= link_directory ../javascripts .js +//= link_directory ../stylesheets .css