Rendering HTML in rails without actually displaying it
Posted
by Kevin Whitaker
on Stack Overflow
See other posts from Stack Overflow
or by Kevin Whitaker
Published on 2010-05-05T18:51:36Z
Indexed on
2010/05/05
18:58 UTC
Read the original article
Hit count: 132
Hello all,
My current project requires me to assemble a .zip file containing HTML and text-only templates for a user to download, for importing into an email marketing program.
I've inherited this project, and currently the code uses a "fake" model (that is a model that does not directly correlate to a database table), in which it stores the entire template in a string, using dynamic variables to populate certain areas. The "fake" model then has a method for creating a zip file.
It seems to me that there has to be a better way to do this. I was wondering if there was a way to move the template into a .erb/haml file, and then write a method that would populate the file in preparation for being zipped up? Basically, is there a way to render an HTML and text file, without actually having to display them?
Thanks for any help.
© Stack Overflow or respective owner