Reputation: 97
I am trying to create a email app that will use a template to create and send automated emails using an email template.
This is what I have tried to use...
<%= f.text_area :body, rows: "20", class: 'form-control', value: render :partial => 'emails/templates/consignment' %>
I just want the new email to be prepopulated with the html in my template.
Upvotes: 2
Views: 779
Reputation: 743
In controller use render_to_string
:
@email_template = render_to_string(:partial => 'emails/templates/consignment', :layout => false,:formats=>[:html])
In your view:
<%= f.text_area :body, rows: "20", class: 'form-control', value: @email_template %>
Upvotes: 2