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;
<h2>Sidebar</h2>
<p><a href="http://www.google.com/">somewhere</a></p>
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?
精彩评论