Forum: Ruby on Rails formatting text in view mode same as edit mode

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
661ae6e97d0e16c2af2aaf7d197e8387?d=identicon&s=25 Sijo k g (sijo)
on 2009-01-02 06:05
Hi
    I have a text are in my edit form as below
<%= text_area "sd_ticket", "description", "cols" => 80, "rows" => 5 %>

    And here i am entering some text with spaces and enter keys ..Now
suppose if it has some 4 paragraphs My problem is when i try to view the
same data in view mode it is not formatted as i gave rather it shows
like its own style I dont get as much enter keys (pargraphs) as I gave
mainly. I used view code like

<%=h @sd_ticket.description %>

     What might be the reason.Please help. I tried the above without h
method ie

<%=h @sd_ticket.description %>   then also no difference

Sijo
Aafa8848c4b764f080b1b31a51eab73d?d=identicon&s=25 Phlip (Guest)
on 2009-01-02 06:59
(Received via mailing list)
> <%= text_area "sd_ticket", "description", "cols" => 80, "rows" => 5 %>
>
>     And here i am entering some text with spaces and enter keys ..Now

<pre><%=h @sd_ticket.description %></pre>
661ae6e97d0e16c2af2aaf7d197e8387?d=identicon&s=25 Sijo k g (sijo)
on 2009-01-02 07:16
Hi
    thanks for your reply..But one problem is pre takes enter keys Thats
ok..But suppose in edit mode suppose if I continue my typing without
pressing enter key and i gave only spaces Then alos in edit mode
everything happen ok automaticaaly each letter goes to new line when it
reaches extreme right..But in the view mode space wont be recognized by
pre ..For that what should I do

Sijo
661ae6e97d0e16c2af2aaf7d197e8387?d=identicon&s=25 Sijo k g (sijo)
on 2009-01-02 07:19
Hi
   Solved it with width option of pre
Sijo
This topic is locked and can not be replied to.