I will share the solution when the text entered in text_area contains line breaks, but the line breaks are not reflected when I look at the post list.
For example, in the post message
xxx yyy zzz
When I intended to enter it, but when I check it in the post list
xxx yyy zzz
It is a coping method when it becomes.
index.html.erb
<%= post.message %>
The part that was
index.html.erb
<%= simple_format(post.message) %>
Let's say.
simple_format is a helper used to display text containing newline characters on the browser. A brief summary of the features of simple_format.
Enclose the string in
<p>
Add<br />
to line breaks Add</ p> <p>
for consecutive line breaks
(See other articles)
Recommended Posts