How do I render_to_string in a model in rails?
If you say that, “You should never be rendering anything from a model. Any rendering — at all — is the responsibility of the controller and view.” Hear me out, or suggest a better way you might solve the problem
My model is a mailer. Just not that of emails, faxes.
Here’s working code:
Tested on Rails 2.3.14. Note that I didn’t find this idea, but just wrapped it in a convenience method.
Of course, don’t assume that I advocate views rendering in models because of this 😉