Skip to content

Remove ActionMailer as a dependency #77

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

coorasse
Copy link

Closes #76

This PR aims to remove ActionMailer as a dependency so solid_errors can be used also in Rails Apps that don't have it as a dependency. I find solid_errors a perfect solution for my smaller projects, and many of them don't actually send emails so require "action_mailer/railtie" is commented out in application.rb

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it as a development dependency anyway

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zeitwerk of course complains if the class is not defined. I looked if I could exclude only this class from eager_loading and requiring it manually only if ActionMailer::Base is defined, but I did not figure out how.
This is the approach I figured: I always define it, and raise if ActionMailer is actually not there. I don't really have performance consent, and we should never reach this point anyway (see below).

Yes, it smells a bit to be honest, so I could investigate more if you think I should.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I'd do: immediatly check if we want to send emails but ActionMailer is not there: show a nice error message and explain how it can be fixed.

@coorasse coorasse marked this pull request as ready for review April 11, 2025 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drop ActionMailer as a dependency
1 participant