在Rails中,我怎样才能允许在文本区域的一些HTML? [英] In Rails, how can I allow some html in a text area?

查看:164
本文介绍了在Rails中,我怎样才能允许在文本区域的一些HTML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Rails应用程序(博客),我正在创建。非常基本的东西。在我的内容区域中,我有一个帖子内容的文本区域。我需要在文本区域包括一些HTML(链接,格式化等)。

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 area (links, formating, etc).

<%= f.text_area :content %>

是否有另外一个标签可以替代text_area,这样可以做到这一点? / b>

Is there another tag that I can use instead of text_area, that will allow me to do this?

推荐答案

您是否在视图中尝试过这种方法?

Have you tried this in the views?

 <%= content.html_safe %>

这篇关于在Rails中,我怎样才能允许在文本区域的一些HTML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆