I have a simple yield use case and for some unknown reason the default case is never shown:
In my super_admin layout I have:
<%= yield :body_id || \'s
Use parentheses:
<%= (yield :body_id) || 'super_admin_main' %>
Or
<%= yield(:body_id) || 'super_admin_main' %>
Without them it is assuming yield (:body_id || 'super_admin_main')
EDIT: Rails 3 uses ActiveSupport::SafeBuffer
instead of string/nil (Rails 2), so the output is not nil even if there is no content_for
provided. So try:
<%= yield(:body_id).empty? ? 'super_admin_main' : yield(:body_id)%>