I have a variable in my view printed on screen as
<%= comment.comment %>
but the output has many new line characters (\n).
How do I get it to actually print new lines whenever we have a \n with comment.comment output?
Try this:
<%= comment.comment.gsub(/\n/, '<br />') %>
Else you can also use simple_format. Here:
<%= simple_format(comment.comment) %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With