ruby-on-railsruby-on-rails-3markitup

Why the content display code html without render it?


I have used MarkiItUp to build a jquery editor. Now when user type content in textarea with html code, like this:

A new <strong>true</strong> question

When record was saved, it save A new <strong>true</strong> question. And when it display on page, it also display like content was saved, is A new <strong>true</strong> question . But i want the content display on web like this:

A new true question

How can i do that?


Solution

  • To display it, use html_safe. This way your string would be rendered as HTML.
    Refer to this question for more info.
    Ruby on Rails: how to render a string as HTML?