在帮助我的方法,我使一个单独的部分为每个模板:渲染而没有经过局部变量
structure=""
if(@page.theme_set = 1) #line 1
render :partial => "first_theme.html", :locals => {:structure => structure}
else
render :partial => "second_theme.html", :locals => {:structure => structure}
end
concat(structure) #line 2
谐音之内,我做到这一点;
<% structure << header %>
<% structure << content_for_first_theme %>
<% structure << footer %>
这三个都是辅助方法。但是,如果我将第1行和第2行移动到部分,则结构不会呈现。我不想初始化局部变量并将局部变量传递给局部变量,而是从局部变量中进行渲染。我哪里错了?