Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing Zeitwerk errors when running Devise without ActionMailer #5485

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

aldent95
Copy link

This fixes the longstanding issue #5140 where Zeitwerk throws errors around when using Devise without ActionMailer.

Overall behaviour shouldn't be effected. The new empty class is only used when the application would otherwise error our (ActionMailer not available and Zeitwerk enabled)

@lxxxvi
Copy link

lxxxvi commented Sep 5, 2022

What is the use for .zeitwerk_enabled? clause in the first place? Wouldn't it be possible just to have the empty class if ActionMailer is not there?

.zeitwerk_enabled? was introduced around Rails 6.0 and devise is backward compatible with Rails 4 (I guess), so this condition may cause issues in earlier versions.

@lomefin
Copy link

lomefin commented Jan 9, 2023

Is there any real damage if it just defines the class if ActionMailer is not defined?
I understand that adding the rule makes it more focused on solving the error.
But it adds a new dependency, so now we don't need ActionMailer but we need Zeitwerk.

I added Devise::Mailer on an initializer and seems to work alright.

If possible, I would just define the class and leave it empty if there is no ActionMailer

@rafaelfranca
Copy link
Collaborator

Would devise even work without Action Mailer? So many of its default modules requires a mailer to exist.

Can you provide how you are planning to use Devise without a mailer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants