Question

In my Rails app, I have a lot of data that is declared as text in the migration file. But when I print these attributes/fields out in the view, all the line breaks are lost and I get one large chunk of text. How do I maintain the line breaks?

Was it helpful?

Solution

This is an HTML problem. Its rules state that consecutive whitespace is converted to a single space.

Rails has a simple_format function that wraps blocks of text in

tags so you get the separation you want

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top