cqc*_*991 11 ruby-on-rails html-safe
在@post.content,我想要
1.simple_format,所以内容将有不同的行,而不是没有中断的单行
2.html_safe,因此用户可以粘贴一些<embed>视频链接,如youtubes
可以单独使用<%= simple_format @post.content %>和<%= @post.content.html_safe %>单独使用
但是当我一起使用它们时:<%= simple_format @post.content.html_safe %>html_safe不起作用,因此<embed>视频不会显示
你能告诉我如何同时启用<embed>代码simple_format吗?还是有其他解决方案来显示@post.content?谢谢!!!
apn*_*ing 16
我告诉simple_format不要清理我的内容:
simple_format(@post.content, {}, :sanitize => false)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6070 次 |
| 最近记录: |