使用2.3.8的导轨。Ruby on Rails:产量content_for显示问题
在我有这种类型的代码
<%content_for :sidebar do %>
<h2>Sidebar</h2>
<p><%=link_to "somewhere", "http://www.google.com/"%></p>
<% end %>
<h1>Pictures#new</h1>
<p>Find me in app/views/pictures/new.html.erb</p>
在application.html.erb模板视图模板我
<!-- END: Header -->
<%= yield(:sidebar) %>
</div>
<div class="gb">
<%= yield %>
当我去查看该页面在浏览器中,而不是在命名的yield中正确显示代码,它正在转义所有标记。例如;
<h2>Sidebar</h2>
<p><a href="http://www.google.com/">somewhere</a></p>
我找不出什么问题。帮帮我!谢谢。
你确定你没有使用<%= h yield(:sidebar)%>吗? – mportiz08 2010-07-31 19:03:03