I’m writing an rails blog app, when I create a new blog, I type things(multiple lines)into the textarea and save it into database using string. But when I display it , the text displays in one single line. What should I do if I want to correct this problem? Should I replace each’\n’ with < b r > in controller, or there are better ideas?
Many thanks!
I’m writing an rails blog app, when I create a new blog, I type
Share
The simple_format string helper might be of help to you.
<%= simple_format(@blog.body) %>