Preserving whitespace & line breaks

I have a text field that submits stuff to my database. When I display this data, it no longer has line breaks, everything is just in one big row. How can I preserve my whitespace and line breaks?

It won't keep it from crunching multiple spaces into one though... if you really need it as is, wrap it in <pre> or <code> or convert all the spaces to &nbsp;....

-philip

Philip Hallstrom wrote:

ActionView::Helpers::TextHelper

sanitize? I'm using it now to process output text but line breaks are still screwed.

simple_format.

Sorry, wasn't very clear on that...

simple_format(text) Returns text transformed into HTML using very simple formatting rules Surrounds paragraphs with <p> tags, and converts line breaks into <br/> Two consecutive newlines(\n\n) are considered as a paragraph, one newline (\n) is considered a linebreak, three or more consecutive newlines are turned into two newlines