Guest User

Untitled

a guest
Nov 18th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. module ApplicationHelper
  2. # Usage:
  3. #
  4. # render_haml <<-HAML, foo: "FOO"
  5. # %p Hello #{foo}!
  6. # HAML
  7. #
  8. def render_haml(template, locals)
  9. engine = Haml::Engine.new(template.gsub(/^#{template[/^\s+/]}/, ''))
  10. engine.render(self, locals)
  11. end
  12. end
Add Comment
Please, Sign In to add comment