From 8ec3f05767590b4eba0b5ace8cc27a932111f472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Tue, 17 May 2022 16:22:57 +0200 Subject: [PATCH] Move interceptors registry into reloader --- config/initializers/register_mail_interceptors.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/config/initializers/register_mail_interceptors.rb b/config/initializers/register_mail_interceptors.rb index b6c9329bb3..3137ca16b9 100644 --- a/config/initializers/register_mail_interceptors.rb +++ b/config/initializers/register_mail_interceptors.rb @@ -28,7 +28,8 @@ # Register interceptors defined in app/mailers/user_mailer.rb # Do this here, so they aren't registered multiple times due to reloading in development mode. - -ApplicationMailer.register_interceptor Interceptors::DefaultHeaders -# following needs to be the last interceptor -ApplicationMailer.register_interceptor Interceptors::DoNotSendMailsWithoutRecipient +Rails.application.reloader.to_prepare do + ApplicationMailer.register_interceptor Interceptors::DefaultHeaders + # following needs to be the last interceptor + ApplicationMailer.register_interceptor Interceptors::DoNotSendMailsWithoutRecipient +end