Render Devise Emails in Email Layout
Thought I’d share this solution as my Googling didn’t result in any hits. If you’re using Devise for authentication in your Ruby on Rails app and have a general HTML template that you want all emails to render in, there’s an easy way to get the default devise emails to also render in it.
Just create a partial with all the code for the email including the <%= yield %>
tag, let’s call it _email_content.html.erb
.
Then create a new file in:
layouts > devise (make this folder if it doesn't exist) > mailer.html.erb
In this file (and your default template file) render your partial:
<%= render "layouts/email_content" %>
There you go. You can still manage your email template from a single location.
49 Notes/ Hide
- webhat liked this
- alexanderok59-blog liked this
- odonnellui781-blog liked this
- heatheryi982-blog liked this
- salvador7dr-blog liked this
- userxs78-blog liked this
- nickthejam liked this
- travisjtodd-blog posted this