In Rails, how can I allow some html in a text area?

前端 未结 6 2598
灰色年华
灰色年华 2021-02-19 21:35

I have a Rails app (blog) that I am creating. Very basic stuff. In my content area I have a text area for the content of the post. I am needing to include some html in the text

6条回答
  •  走了就别回头了
    2021-02-19 21:48

    The HTML safe method is actually .html_safe. Just tested on a text field.

    For example:

    <%= @item.description.html_safe %>
    

提交回复
热议问题