Skip to content

Commit

Permalink
Merge pull request #5731 from heartcombo/fix-without-mailer-load
Browse files Browse the repository at this point in the history
Fix Zeitwerk autoloading when ActionMailer is not present.
  • Loading branch information
nashby authored Nov 25, 2024
2 parents 90a3fa8 + af112a2 commit 7eccc91
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
* Add Rails 8 support.
- Routes are lazy-loaded by default in test and development environments now so Devise loads them before `Devise.mappings` call.
* bug fixes
* Make `Devise` work without `ActionMailer` when `Zeitwerk` autoloader is used.
Please check [4-stable](https://github.com/heartcombo/devise/blob/4-stable/CHANGELOG.md)
for previous changes.
6 changes: 6 additions & 0 deletions lib/devise/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7eccc91

Please sign in to comment.