문제

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] %>
도움이 되었습니까?
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top