views:

30

answers:

1

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?

+1  A: 

Try render_to_string.

Tass
Thanks, I didn't know it existed!
remi