In the @post.content
, I want
1.simple_format, so content would have different lines rather than in a single line without breaks
2.html_safe, so user could paste some <embed>
video link like youtubes
It's OK to use <%= simple_format @post.content %>
and <%= @post.content.html_safe %>
separately
But when I use them together: <%= simple_format @post.content.html_safe %>
, html_safe is not working, and hence the <embed>
video is not displayed
Could you tell me how can I enable <embed>
code and simple_format
at the same time? or is there other solutions to display the @post.content
? Thanks!!!
simple_format(@post.content).html_safe
? this would call html safe on the output of simple_format rather than 'simple_formatting' the html_safe version of post.content. – Wristlet@post.content
? – Wristlet<embed>
code is displayed. apneadiving's answer is working – Borrow