【发布时间】:2010-07-31 18:32:03
【问题描述】:
使用 2.3.8 的 rails。
在视图模板中我有这种类型的代码
<%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 中正确显示代码时,它正在转义所有标签。 EG;
<h2>Sidebar</h2>
<p><a href="http://www.google.com/">somewhere</a></p>
我不知道出了什么问题。帮助!谢谢。
【问题讨论】:
-
你确定你没有使用 吗?
标签: ruby-on-rails ruby content-for