How to get the rendered string without using render_to_string


I have a few sample letters that needs to be sent out. As part of the specification the layout needs to be used and to be shown to legal and then mail those letters and log the full content in the database.

The strategy is to prepare full body before the email is actually sent out.

In order to get the body of the email I was using,

body_of_email = render_to_string(:action => ‘email_templates/letters_to_vendor’, :layout => false

It worked in some cases but now I am getting

Can only render or redirect once per action

Is there a way to get the output of the templates as a string after substitution without using render functionality. I am new to Ruby.