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? -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
> 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?http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#M000516 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 .... -philip --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Philip Hallstrom wrote:> http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#M000516sanitize? I''m using it now to process output text but line breaks are still screwed. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
> Philip Hallstrom wrote: >> http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#M000516 > > 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 --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---