开发者

Ruby on Rails: Yield content_for Display Issues

Using 2.3.8 of rails.

In the view template I have this type of code

<%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>

In the application.html.erb template I have

<!-- END: Header -->
<%= yield(:sidebar) %>
</div>

<div class="gb">
<%= yield %>

When I go to view the page in a browser instead of showing the code correctly in named yield it is escapi开发者_C百科ng all the tags. EG;

&lt;h2&gt;Sidebar&lt;/h2&gt;
  &lt;p&gt;<a href="http://www.google.com/">somewhere</a>&lt;/p&gt;

I can't figure out what is going wrong. Help! Thanks.


I see a random </div> in your application.html.erb file--maybe that's causing the problem?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜