Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jugyo
Created June 26, 2012 01:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jugyo/2992584 to your computer and use it in GitHub Desktop.
Save jugyo/2992584 to your computer and use it in GitHub Desktop.
render_haml helper
module ApplicationHelper
# Usage:
#
# render_haml <<-HAML, foo: "FOO"
# %p Hello #{foo}!
# HAML
#
def render_haml(template, locals = {})
engine = Haml::Engine.new(template.gsub(/^#{template[/^\s+/]}/, ''))
engine.render(self, locals)
end
end
@braindeaf
Copy link

Of course, this finally broke with Haml 6.0 upgrade but we had a good run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment