Created
February 8, 2009 09:38
-
-
Save kubicek/60327 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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