I’ve been on few projects where we need to have client-side view templates. This would mostly involve making an AJAX request to the server, getting back some JSON data at which point we need to convert this into HTML. EJS is one of a number of solutions to this problem.
I’m not saying EJS is the best solution, but it’s straightforward to integrate, understand and use.
To start off, add the EJS gem to your Gemfile.
The result will be a simple HTML string for you to insert into the DOM.
As I said, I’m not saying EJS is the best solution out there, but it’s really easy to use and all the templates live on the client – no extra requests are made to the server (apart from the actual data).