Closed pgib closed 11 months ago
In my real project, I monkey-patched Jets::Router::Finder#reset_routes!
to not do anything, and then I manually copied the email.html.erb
view into my app as app/views/jets/mailers
. I'm at least able to see my individual mailer previews.
config/initializers/finder.rb
# Monkey-patch this to get mailer previews working. For some reason after
# clearing the routes, the internal mailer preview routes are not re-added.
#
# This will likely mean we'll need to restart the server when changing routes.
class Jets::Router
class Finder
def reset_routes!
return
end
end
end
(Updated the same project to show the effect of this.)
Went through docs for v5 testing and it worked.
https://docs.rubyonjets.com/docs/email/previews/
So seems fixed.
Checklist
jets upgrade
command that makes this a simple task. There's also an Upgrading Guide: http://rubyonjets.com/docs/upgrading/My Environment
Expected Behaviour
Following the instructions in the documentation should result in the mailer preview showing a preview of the email.
Current Behavior
ArgumentError.
Step-by-step reproduction instructions
I created a brand new project and followed the instructions (minus the migration) to turn on mailer previews and create a mailer preview model.
In my real project, I was noticing that the
/jets/mailer
routes seem to disappear when theJets::Router::Finder
callsreset_routes!
. That project was initialized as anapi
project; however, I did try settingconfig.mode = 'html'
in theenvironments/development.rb
file. It's unclear to me exactly how things are different between api and html mode.Code Sample
https://github.com/pgib/jets-mailer-preview-example
Solution Suggestion
If there's any guidance to help me trace through how these routes are generated and how the built-in templates are supposed to be served, I'm happy to keep digging. I've ran into a bit of a wall at the moment.