Skip to content

Instantly share code, notes, and snippets.

@Jamedjo
Created December 19, 2013 17:14
Show Gist options
  • Save Jamedjo/8042824 to your computer and use it in GitHub Desktop.
Save Jamedjo/8042824 to your computer and use it in GitHub Desktop.

Like content_for but takes a default output from a block if content_for? hasn't been set.

= content_default(:sidebar) do
  = render 'sidebar'
def content_default(section)
if content_for?(section)
content_for(section)
else
capture(&Proc.new)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment