Skip to content

Instantly share code, notes, and snippets.

@rickmzp
Created March 21, 2009 09:37
Show Gist options
  • Save rickmzp/82792 to your computer and use it in GitHub Desktop.
Save rickmzp/82792 to your computer and use it in GitHub Desktop.
module ApplicationHelper
def inside_layout(layout, &block)
@template.instance_variable_set("@content_for_layout", capture(&block))
layout = layout.to_s.include?("/") ? layout : "layouts/#{layout}" if layout
buffer = eval("_erbout", block.binding)
buffer.concat(@template.render(:file => layout))
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment