2 ms·
I mean that you would have JS in your app/views folder together with the HTML views, instead of the assets folders only. 1. It doesn't depend from RJS/render :
by izietto 13y ago
I mean that you would have JS in your app/views folder together with the HTML views, instead of the assets folders only.
1. It doesn't depend from RJS/render :json, but from the fact that your controller responds to sync requests, in addition to the async ones.
2. You can tell to render :json to use server side (erb) partials:
render json: { html: render_to_string(partial: 'product') }
I do it all the time
- rartichoke 13y agoI didn't know about #2, that's really cool. How does render_to_string handle cached partials? Does it still need to compute the output of the partial's string representation on every request?