In one of my models I have a method that sends an email. I’d like to mark up this email via a Haml file that’s stored together with my other views.
Is there a way to call Sinatra’s HAML-helper from within a model? If not, I will need to call Haml directly like so:
@name = 'John Doe'
Haml::Engine.new(File.read("#{MyApplication.views}/email.haml")).to_html
Is there a way for the Haml template to have access to the @name instance variable?
Try something like this:
Hope this helps!