# Newlines in text\_area

**URL:** <https://www.ruby-forum.com/t/newlines-in-text-area/126832>\
**Category:** Rails\
**Created:** [January 22, 2008, 5:10pm UTC](https://www.ruby-forum.com/t/newlines-in-text-area/126832 "2008-01-22T17:10:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![flnative](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/5daacb/32.png) [@flnative](https://www.ruby-forum.com/u/flnative)\
**Post date:** [January 22, 2008, 5:10pm UTC](https://www.ruby-forum.com/t/newlines-in-text-area/126832/1 "2008-01-22T17:10:15Z")

</div>

Hi @ all  
I would like to enter a text with a text\_area into the database. It runs  
excellent. But when I want to show the entered text in the show view,  
all newlines (paragraphs) are deleted and the text is only one block.

How can I save the returns (newlines) too?

Thanks for helping!!

---

<div class="post-metadata">

**Author:** ![flnative](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/5daacb/32.png) [@flnative](https://www.ruby-forum.com/u/flnative)\
**Post date:** [January 22, 2008, 5:21pm UTC](https://www.ruby-forum.com/t/newlines-in-text-area/126832/2 "2008-01-22T17:21:55Z")

</div>

K. R. :

> I would like to enter a text with a text\_area into the database. It runs  
> excellent. But when I want to show the entered text in the show view,  
> all newlines (paragraphs) are deleted and the text is only one block.
> 
> How can I save the returns (newlines) too?

simple\_format helper can be useful :  
[http://api.rubyonrails.com/classes/ActionView/Helpers/TextHelper.html#M001057](http://api.rubyonrails.com/classes/ActionView/Helpers/TextHelper.html#M001057)

– Jean-François.

---

<div class="post-metadata">

**Author:** ![flnative](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/5daacb/32.png) [@flnative](https://www.ruby-forum.com/u/flnative)\
**Post date:** [January 22, 2008, 8:42pm UTC](https://www.ruby-forum.com/t/newlines-in-text-area/126832/3 "2008-01-22T20:42:14Z")

</div>

Gives it other solutions to display the text in the originally format  
with paragraphs and so on…?

Jean-FranÃ§ois TrÃ¢n wrote:

> K. R. :
> 
> > I would like to enter a text with a text\_area into the database. It runs  
> > excellent. But when I want to show the entered text in the show view,  
> > all newlines (paragraphs) are deleted and the text is only one block.
> > 
> > How can I save the returns (newlines) too?
> 
> simple\_format helper can be useful :  
> [Peak Obsession](http://api.rubyonrails.com/classes/ActionView/Helpers/TextHelper.html#M001057)
> 
> – Jean-Franï¿½ois.

---

<div class="post-metadata">

**Author:** ![flnative](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/5daacb/32.png) [@flnative](https://www.ruby-forum.com/u/flnative)\
**Post date:** [January 24, 2008, 12:07am UTC](https://www.ruby-forum.com/t/newlines-in-text-area/126832/4 "2008-01-24T00:07:23Z")

</div>

simple\_format does that.

Alternatively:

\<%= @string.gsub("\n","  
") %\>

---

<div class="post-metadata">

**Author:** ![flnative](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/5daacb/32.png) [@flnative](https://www.ruby-forum.com/u/flnative)\
**Post date:** [January 24, 2008, 7:51am UTC](https://www.ruby-forum.com/t/newlines-in-text-area/126832/5 "2008-01-24T07:51:50Z")

</div>

great, thanks for helping @ all!

> simple\_format does that.
> 
> Alternatively:
> 
> \<%= @string.gsub("\n","  
> ") %\>
