Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix default mailer class not resolving with autoloading in background…
… jobs The `Rodauth::Rails::Feature` class gets autoloaded only when the Rodauth configuration is getting evaluated. In the web server, this happens immediately before the request reaches the Rails router, because the Rodauth middleware loads the Rodauth app, which in turn loads Rodauth configuration. However, in a background job process, enqueued email deliveries will first resolve the mailer class, and then the mailer will load the Rodauth configuration. So, the job processor will attempt to resolve `Rodauth::Rails::Feature::Email::Mailer`, which fails, because the `rails` Rodauth feature hasn't yet been loaded. The solution is simple: move the mailer class in a place where it can be autoloaded without the feature being loaded. As a bonus, this results in a much shorter `Rodauth::Rails::Mailer` class. Fixes #337
- Loading branch information