I have a Rails 3 application that is serving a js file e.g., tools.js.erb via the assets pipeline. This is working fine, but I want to add some html templates which are available as partials within the environment.
One option was to load the template via an ajax call from the JS when the template is required, but that would add some delay in presenting it on the client.
Is it possible to render a partial inside the JS and store it in a JS variable as a string, so I can just inject the html right away. What is the best way to do this?