Rails — Add a line break into a text area

Line breaks in textareas are produced as `\n’. However, the problem is that if you simply dump it into your view, it will just be line breaks in your HTML source.

You can try using the Rails simple_format helper to take care of some of this for you: http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#M002285

It will auto-convert line breaks to HTML tags. You can use it with something like <%= simple_format(my_text_field) %>.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)