Search code examples
htmlruby-on-railsruby-on-rails-4slim-lang

How to render HTML encoded text in SLIM


In my rails application I am using slim for template rendering. Now I have a field which has some HTML tags.

@description = "This is first line <br> second line. some <b>more</b> formatting."

In view.html.slim

p = @description

It is generating following output

This is first line <br> second line. some <b>more</b> formatting.

Where as I want it to be like

This is first line
second line. some more formatting.

My question is: How can I render this html encoded text in slim?

Thanks


Solution

  • Try

    p = @description.html_safe