In a layout, I want to output certain areas, only when there is data for them.
This is easy for named partials, but how do I check for the default yield?
-if content_for nil
#content.span-24
= yield
Can I actually yield nothing at all?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try
content_for?(name)Instead of rendering the content,
content_for?will give you the boolean you’re looking for.UPDATE
Well, for the default case, you could do something like: