I had a similar problem.   I expect users to enter html or xml in my 
text area and I also wanted to retain line breaks when rendering a page. 
The solution was quite simple

The html <pre> tag retained the line breaks and html_escape allowed me 
to render the html.  This  is probably a rather large security hole but 
I'm working on an internally facing application so it's okay.   The user 
can now enter whatever they want in the textarea and it's rendered 
correctly when I display the data on another page.

When I render the text, it now looks like...

There should be a line break
here!
<br>
<hr>

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to