Question

I have a web app that renders views client-side with EJS. EJS uses the ERB syntax:

<!-- /views/posts/_comment.jst.ejs -->

<article id=<%= comment.id %>>
<%= comment.body %>
</article>

I’m also rendering the view with the Rails server. The partial to render it server-side would look identical to the EJS. How can I reuse the EJS and have Rails think it’s a standard ERB partial?

<!-- /views/posts/comments.html.erb -->

<h2>Comments:</h2>

<!— This doesn’t work: —>
<%= render partial: ‘_comment.jst.ejs’, :formats => [:erb] %>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top