Yield and default case || do not output default case
Posted
by coulix
on Stack Overflow
See other posts from Stack Overflow
or by coulix
Published on 2010-05-25T18:06:05Z
Indexed on
2010/05/25
18:21 UTC
Read the original article
Hit count: 184
Hello Railers,
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 || 'super_admin_main' %>
My controller
class Superadmin::GolfsController < ApplicationController
layout "super_admin"
def show
end
end
My show view
With or without
<% content_for(:body_id) do %>sadmin_golfs<% end %>
With: sadmin_golfs is shown.
without: empty string is shown instead of super_admin_main
Can anyone reproduce the same behavior ?
Rails 3
© Stack Overflow or respective owner