How can i convert/replace every newline to '
'?

前端 未结 5 1690
南笙
南笙 2021-01-21 05:55
set tabstop=4
set shiftwidth=4
set nu
set ai
syntax on
filetype plugin indent on

I tried this, content.gsub(\"\\r\\n\",\"
\")
bu

5条回答
  •  萌比男神i
    2021-01-21 06:18

    You need to use html_safe if you want to render embedded HTML:

    <%= @the_string.html_safe %>
    

    If it might be nil, raw(@the_string) won't throw an exception. I'm a bit ambivalent about raw; I almost never try to display a string that might be nil.

提交回复
热议问题