2

For some reason, I want to store the HTML code outputted from render into a database.

For example, this is the content of a template (app/views/mailer/someview.html.erb):

Hello <%= @foo %>.

And I would like to store "Hello Jim." in my database by providing the template (mailer/someview) and the variables to replace (:foo => "bar").

Is there any way I can do this in Ruby on Rails?

0

1 Answer 1

4

Try render_to_string.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I didn't know it existed!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.