How do I get line breaks in my text fields and boxes?

0 views
Skip to first unread message

Dave

unread,
Oct 2, 2006, 7:36:14 PM10/2/06
to rubyonra...@googlegroups.com
Hi, I'm new to programming and Ruby on Rails, hence this probably simple
question.

I'm creating a simple recipe application, and I want to preserve the
line breaks when a user hits "enter" between ingredients and directions.
However, when I submit a recipe now it all shows up on one line. Is
there a simple way to preserve these user-generated line breaks? As a
followup, is it much harder to change those line breaks into ordered
lists?

Thanks in advance!

Dave

--
Posted via http://www.ruby-forum.com/.

Nicolas Cavigneaux

unread,
Oct 3, 2006, 5:30:41 AM10/3/06
to rubyonra...@googlegroups.com

Le 3 oct. 06 à 01:36, Dave a écrit :

>
> Hi, I'm new to programming and Ruby on Rails, hence this probably
> simple
> question.
>
> I'm creating a simple recipe application, and I want to preserve the
> line breaks when a user hits "enter" between ingredients and
> directions.
> However, when I submit a recipe now it all shows up on one line. Is
> there a simple way to preserve these user-generated line breaks? As a
> followup, is it much harder to change those line breaks into ordered
> lists?

You should try simple_format("your text") to preserve line breaks.

You can easily translate line breaks to list using String.gsub.
--
Nicolas Cavigneaux
http://www.bounga.org
http://www.cavigneaux.net


Reply all
Reply to author
Forward
0 new messages