2014年6月8日 星期日

render partial

render partial ?

<%= render partial: 'postAttachedMustache', :mustache => json_for(post) %>

---------------------------
template.locals
-> []
<%= render partial: 'postPhotoMustache', locals: {:mustache => json_for(post)} %>

---------------------------
template.locals
-> ['mustache']
if with partial , you normally need to use locals: { your parameter }
<%= render 'postTextMustache', :mustache => json_for(post) %>

---------------------------
template.locals
-> ['mustache']
if without partial , you don't need to use loacls , because all the parameters you use are already locals

沒有留言:

張貼留言