Ruby's simple_format method is not working for spaces

Ruby’s simple_format method is not working for spaces. so how to add and
what to add in simple format method code so it also work for spaces?

On 29 May 2008, at 07:17, Sunny B. wrote:

Ruby’s simple_format method is not working for spaces. so how to add
and
what to add in simple format method code so it also work for spaces?

What are you expecting it to do to spaces? It’s only suppose to
convert newlines to paragraph/
tags

Fred

Frederick C. wrote:

On 29 May 2008, at 07:17, Sunny B. wrote:

Ruby’s simple_format method is not working for spaces. so how to add
and
what to add in simple format method code so it also work for spaces?

What are you expecting it to do to spaces? It’s only suppose to
convert newlines to paragraph/
tags

Fred

But if i want to show whatever i typed in text box same to UI (including
spaces,newline, tab ) then there is another way doing it in ruby.

Frederick C. wrote:

On 29 May 2008, at 10:19, Sunny B. wrote:

convert newlines to paragraph/
tags

Fred

But if i want to show whatever i typed in text box same to UI
(including
spaces,newline, tab ) then there is another way doing it in ruby.

Replace spaces with   or enclose everything in

Fred

I am trying this replaces all spaces with   then other code is not
working means(new line paragraph)
I am writing following method
def simple_format_include_spaces(text)
content_tag ‘p’, text.to_s.
gsub(/[" "]/, " " ).
gsub(/\r\n?/, “\n”). # \r\n and \r -> \n
gsub(/\n\n+/, “

\n\n

”). # 2+ newline -> paragraph
gsub(/([^\n]\n)(?=[^\n])/, ‘\1
’) # 1 newline -> br
end

but it not working. and pre tag is also not work for spaces

On 29 May 2008, at 10:19, Sunny B. wrote:

convert newlines to paragraph/
tags

Fred

But if i want to show whatever i typed in text box same to UI
(including
spaces,newline, tab ) then there is another way doing it in ruby.

Replace spaces with   or enclose everything in

Fred