开发者

<%=yield%> not working in named templates

<%=yield%> works perfectly if my template is called layouts/application.erb. However, if I change the template to something else, then the yield doesn't work. For instance, my controller method is

render :template=>'layouts/survey'

and the right template gets rendered, but its yield method doesn't show the output of the current action's view. What simple thing am I missing? I have also tried

render :action=>"index", :template=>"layouts/survey"
开发者_开发百科

to no avail.


Are you sure you want to be using :template and not :layout?


By "template" you mean the layout apparently. Then the option isn't the good one. It's :layout

render :action => 'index', :layout => 'survey'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜