From 95e08568d0d4cc4fec5004b6bec25d662b22b5c1 Mon Sep 17 00:00:00 2001 From: Vasiliy Ermolovich Date: Sun, 17 Nov 2024 12:10:30 +0100 Subject: [PATCH] Fix Zeitwerk autoloading when ActionMailer is not present. --- lib/devise/rails.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/devise/rails.rb b/lib/devise/rails.rb index dad9e86dc..b5738853f 100644 --- a/lib/devise/rails.rb +++ b/lib/devise/rails.rb @@ -47,5 +47,11 @@ class Engine < ::Rails::Engine ) end end + + initializer "devise.configure_zeitwerk" do + if Rails.autoloaders.zeitwerk_enabled? && !defined?(ActionMailer) + Rails.autoloaders.main.ignore("#{root}/app/mailers/devise/mailer.rb") + end + end end end