Our Rails projects make heavy use of content_for. However, we quite often need to render default content if nothing is defined using content_for. F
content_for
This can be done entirely in the view using the content_for? method.
<% if content_for?(:sidebar_content) %> <%= yield(:sidebar_content) %> <% else %> <ul id="sidebar"> <li>Some default content</li> </ul> <% end %>