Textarea and line breaks

Hi everyone!
Guys I am facing very irritating problem of line breaks in text area, i used “gsub” method to replace \r\n to
, but i didn’t got the result as was i expecting.
Could anybody give me any suggestions to resolve this issue?

Thanks,
Shahroon

<%= simple_format(@record.field_name) %>

Best regards

Peter De Berdt

simple_format gave me this

James,
Andy,
Candy

but i want line breaks like this

James
Andy
Candy

I hope now you can understand what my problem is.

Thanks,
Shahroon

Sending again :slight_smile:

simple_format gave me this

James,
Andy,
Candy

but i want line breaks like this

James
Andy
Candy

I hope now you can understand what my problem is.

Thanks,
Shahroon

Sending again :slight_smile:

why? was 24 minutes of waiting too long?

I hope now you can understand what my problem is.

no, not really.

anyhow:

<p>James, <br />Andy, <br />Candy</p>

this is actually what i thought you are trying to achieve after
reading this:

i used "gsub" method to replace \r\n to <br/>

now, i don't know what your data looks like, but you surely could use
split! to split a string into several parts and output the resulting
array like this:

  names_array.each { |name| puts name }

which would give you what you want:

:slight_smile: , that was not an issue of waiting actually I thought my emails are going some where else due to this message of boxbe, so thats why.

Now come to real issue, actually Mayer i have a text area for entering a list of developers or list of anything like this

  1. Abcd
  2. this is my second line
  3. this is my third line
    now whenever i want to display this thing as a list it comes to me like a paragraph,
    i tried these
    simple_fromat(@vteam.developers)
    and
    simple_fromat(sanitize(@vteam.developers))
    and
    (@vteam.developers).gsub("\r\n","
    ")
    but none these worked.

Thanks,
Shahroon

Okay thanks, I got the solution.
thats simply
(@vteam.developers).gsub("\n","
")

Shahroon

Why don't you just do a team has_many developers and add a text_field
with developers that can be added??? Entering the developers in a text
area as a list does not sound like a good idea...

If you had many developers you would just create the list with
team.developers.each and you are golden...

I know you are right, and I convinced my client as well but he insist me to do like this.

Thanks,
Shahroon