Blankman
Blankman

Reputation: 267390

Display partial unless content_for was defined?

What I want to do is, show default sidebar content UNLESS the current view has something else to display in the sidebar.

How would I do this? (rails3)

Upvotes: 0

Views: 329

Answers (1)

Ryan Bigg
Ryan Bigg

Reputation: 107738

content_for?(:sidebar) ? yield(:sidebar) : render(:partial => "shared/default_sidebar") 

Upvotes: 3

Related Questions