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.
46 Notes/ Hide
-
alexanderok59 likes this
-
odonnellui781 likes this
-
heatheryi982 likes this
-
salvador7dr likes this
-
userxs78 likes this
-
nickthejam likes this
-
travisjtodd posted this