How to have Rails Views process HTML tags from database content?

前端 未结 2 1084
长发绾君心
长发绾君心 2020-12-28 14:49

Ok. I know this is very basic. I want to have some basic tags around text content in the database to be processed in the view\'s rendering.

Basically, I have a model

相关标签:
2条回答
  • 2020-12-28 15:15

    You can use the raw helper method.

    <%=raw @page.content %> 
    
    0 讨论(0)
  • 2020-12-28 15:21

    <%= @page.content.html_safe %> if you are safe with it's content.

    0 讨论(0)
提交回复
热议问题