oprogfrogo
oprogfrogo

Reputation: 2074

Rails - Text's double spaces to single space

text_from_db = "I love  Ruby"

When I display this in the view, it shows as "I love Ruby". There should be two spaces after the word 'love'. I've tried simple_format but it doesn't seem to work.

Upvotes: 0

Views: 352

Answers (1)

Gareth
Gareth

Reputation: 138012

This is an HTML question, the clue is that you do see two spaces in the HTML source. All you need to do is make sure that the

white-space: pre;

CSS property is applied to your text, for example by using the <pre> elemeent

Upvotes: 2

Related Questions