Disable HTML escaping in erb templates

前端 未结 3 865
温柔的废话
温柔的废话 2020-11-27 20:01

In a Rails 3 application I have a domain class where one attribute stores pure HTML content (it\'s a blog app, the domain class is Post).

In the ERB templates, I ne

3条回答
  •  余生分开走
    2020-11-27 20:33

    Using a double equals means the result is not escaped...

    <%== somePost.content %>
    

    See this SO question about it - What does <%== %> do in rails erb?

提交回复
热议问题