开发者

Show <br/> in <p>

i replaced line feed characters with HTML line break as

@post.description.gsub(/\n/, "<br/>")

I am trying to show the output w开发者_JAVA百科ithin

tags. But I see as follows:

Used, like new book<br/>New book costs $150<br/>Awesome book!

Need help. Thanks.


Use simple_format for this as it will automatically convert new lines into breaks.

<%= simple_format(@post.description) %>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜