I’m trying to get Rails Mailer Previews working on my app, and I want them to work on production (I know it is a security risk, but I think I can monkey patch Rails::MailersController to require to auth). in production.rb I’ve set config.action_mailer.show_previews = true but for some reason I am getting this on prod:
2024-03-28T17:48:38.809127+00:00 app[web.1]: [a7572d16-cbd1-4246-9f13-42c840b079d9] Started GET "/rails/mailers/donor_mailer/welcome_email" for 174.228.100.24 at 2024-03-28 17:48:38 +0000
2024-03-28T17:48:38.809714+00:00 app[web.1]: [a7572d16-cbd1-4246-9f13-42c840b079d9] Processing by Rails::MailersController#preview as HTML
2024-03-28T17:48:38.809732+00:00 app[web.1]: [a7572d16-cbd1-4246-9f13-42c840b079d9] Parameters: {"path"=>"donor_mailer/welcome_email"}
2024-03-28T17:48:38.810160+00:00 app[web.1]: [a7572d16-cbd1-4246-9f13-42c840b079d9] Completed 404 Not Found in 0ms (ActiveRecord: 0.0ms | Allocations: 179)
2024-03-28T17:48:38.811846+00:00 app[web.1]: [a7572d16-cbd1-4246-9f13-42c840b079d9]
because production doesn't autoload, you must autoload the previews explicitly if they are Rspec
in
config/application.rb
works to load them into prod