What’s the best way to handle formating of a text_area? I have a
text_area
in my rails app where people can leave comments and I’d like to
automatically convert the line breaks into tags, or just simply
wrap
a whole paragraph in
tags. I’m currently doing the following in
my
comments controller to insert line breaks when the user presses
within the text_area, however I know there has to be a better way.
I think you would be better off to leave the raw data (maybe you want to
email the comment some day??) alone and only translate the line feeds to
br’s in your views when presenting the data. Use Gerards response to do
that.