Skip to content

Instantly share code, notes, and snippets.

@kubicek
Created February 8, 2009 09:38
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 kubicek/60327 to your computer and use it in GitHub Desktop.
Save kubicek/60327 to your computer and use it in GitHub Desktop.
get '/?' do
haml_with_erb_layout :index
end
def haml_with_erb_layout(template, options={})
require 'haml' unless defined? ::Haml
require 'erb' unless defined? ::ERB
# options[:options] ||= self.class.haml if self.class.respond_to? :haml
data = lookup_template(:haml, template, options)
output = __send__("render_haml", template, data, options)
layout, data = lookup_layout(:erb, options)
if layout
__send__("render_erb", layout, data, options) { output }
else
output
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment