Sinatra HTML in HAML not working

I’ve been at this for a few hours and cannot seem to figure it out. I
have a sinatra application, which retrieves a data from a database and
creates a Post object. A field/attribute of post is named content (ie:
post.content) , which contains html data. I’m attempting to display
this content “AS HTML” in haml, but not having any luck.

In my haml form I have an @post object. The @post.content = COOL


cool beans man

How do I display this in a haml page as actual html and not just a
string of useless nonsense?

I’ve tried many things and it just displays the sting of html instead of
actually displaying the html “AS HTML” in the page.

!= #{@post.content}
= @post.content

I’ve tried dozens of other methods posted online, but for the life of me
cannot figure it out. I think rails has something like html_safe.

If I put something like "


in the haml page it displays

Any help is greatly appreciated. Thanks.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs