ruby on rails - Add new line using /n in text variable -
i have variable in view printed on screen
<%= comment.comment %>
but output has many new line characters (\n
).
how print new lines whenever have \n
comment.comment
output?
try this:
<%= comment.comment.gsub(/\n/, '<br />') %>
else can use simple_format
. here:
<%= simple_format(comment.comment) %>
Comments
Post a Comment