config: fix DynamicSmtpSettingsInterceptor warning again
This warning re-appeared when running mailer tests: ``` DISABLE_SPRING=1 bin/rspec spec/mailers/administration_mailer_spec.rb ``` It is now fixed properly, in a way recommanded by the documentation.
This commit is contained in:
parent
abb8b04208
commit
b0735aafe0
2 changed files with 12 additions and 1 deletions
|
@ -1,3 +1,14 @@
|
|||
# We want to register an interceptor, but we can't make the action idempotent
|
||||
# (because there's no way to peek at the currently registered interceptors).
|
||||
#
|
||||
# To make zeitwerk happy, instead signal that we don't want the
|
||||
# DynamicSmtpSettingsInterceptor constant to be auto-loaded, by:
|
||||
# - adding it to a non-autoloaded-path (/lib),
|
||||
# - requiring it explicitely.
|
||||
#
|
||||
# See https://guides.rubyonrails.org/autoloading_and_reloading_constants.html#autoloading-when-the-application-boots
|
||||
require 'action_mailer/dynamic_smtp_settings_interceptor'
|
||||
|
||||
ActiveSupport.on_load(:action_mailer) do
|
||||
ActionMailer::Base.register_interceptor "DynamicSmtpSettingsInterceptor"
|
||||
ActionMailer::Base.register_interceptor DynamicSmtpSettingsInterceptor
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue