Rails is preserving all the line breaks and so forth when the text is
written to the database. But when you display this text on a web page,
is in interpreted as HTML, which collapses multiple spaces to one, and
ignores line breaks.
Somehow you need to get HTML tags marking up your text. My preferred
way to do this is to use Textile markup for the text, and then Textile
will create the HTML markup for you.
Here''s an article that explains how to use Textile:
http://www.buildingwebapps.com/articles/6-easy-text-formatting-with-textile
Michael Slater
www.BuildingWebApps.com
www.LearningRails.com
On Jan 11, 12:49 am, Neon
<azte...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hello all,
>
> I''m still fairly new to RoR. Had a question related to a
form''s text
> field data. Given a blog model for example, with fields: title, date
> and body. If I were to type a full body''s worth of text with line
> breaks and such, much like I am doing now within this message field of
> the post. How would I be able to preserve the original typed in
> format without resorting to the use of the <pre> html element within
> the view template or having to input data in the field using <p> and
> <br> html elements?
>
> I tried to glean off any information from the "Blog in 15 mins"
> railscast @ rubyonrails.org, but David only posted one sentence data
> in each body field. So nothing much to go on there.
>
> -Neon
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---