Yield and default case || do not output default case

前端 未结 7 1252
刺人心
刺人心 2021-02-14 15:49

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         


        
7条回答
  •  忘掉有多难
    2021-02-14 16:14

    You can use content_for?(:body_id), the code will be like.

    <%= content_for?(:body_id) ? yield(:body_id) : 'super_admin_main' %>
    

提交回复
热议问题