Skip to content

Instantly share code, notes, and snippets.

@volh
Created November 24, 2010 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save volh/714243 to your computer and use it in GitHub Desktop.
Save volh/714243 to your computer and use it in GitHub Desktop.
rails 3 engine helper to render inside base application layout, even if there is no content_for in it
# Updated from several code snippets
def base_layout(layout="application")
@_content_for[:layout] = self.output_buffer
self.output_buffer = render :file => "layouts/#{layout}"
end
# just add <%= base_layout %> at the end of your engine layout.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment