Preserving page breaks from form input

In my Rails application, I want to save \n

which are entered in forms. What I have done so far is outputted with simple_format()

. But the problem is simple_format wraps the text in <p> / p> if any \n

. This is problematic for my chat log as I don't want every message to appear in a new paragraph.

What should I do instead?

0


a source to share


1 answer


text.gsub("\n",'<br/>')

      



+1


a source







All Articles