Replace HTML code in Views
suggest changecontent_for captures a block in a view. yield prints it from the layout. Put yield in the layout. If both are in the same template, call content_for before yield, or the yield runs while the block is still empty.
Layout
<div>
<%= yield :header %>
</div>
View
<% content_for :header do %>
<ul>
<li>Line Item 1</li>
<li>Line Item 2</li>
</ul>
<% end %>
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents