<%=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'
精彩评论