Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Processing HAML from database in ruby on rails

Wondering if it's possible to process HAML from database entries. My model currently processes HTML just fine, but I'd rather input HAML, and have the view process it into HTML.

like image 718
aperture Avatar asked Dec 16 '22 19:12

aperture


2 Answers

If your view is being replaced entirely by something coming from your model/database, you can use render :inline to process it:

render :inline => @model.haml, :type => 'haml', :layout => true
like image 75
Josh Leitzel Avatar answered Jan 03 '23 17:01

Josh Leitzel


Haml can be used programmatically: http://haml.info/docs/yardoc/Haml/Engine.html

There isn't enough detail in your question for me to give a more specific answer.

like image 30
Alex Korban Avatar answered Jan 03 '23 17:01

Alex Korban