I would like to get the html that would be sent if a client were to make a request of a certain controller action. However, I would like to do this from the server. I would like to store this raw html in a database for use at some later date. How can this be done?
Edit: I need the extras that are sent with a response as well, stylesheets, scripts, etc…
I was hoping that I wouldn’t have to do this as it seems a bit hacky, but this can be achieved by placing the desired html into a partial, then calling
See this link for more details:
http://www.justinbritten.com/work/2008/10/rendering-rails-partials-in-a-model-or-background-task/
Edit: the method described in the link above only works pre Rails 3. For rails 3, use AbstractController to achieve rendering.