Rails — Add a line break into a text area

前端 未结 11 997
南旧
南旧 2020-12-12 10:21

I got a rails app where I can input a few paragraphs of text into my model. The problem is I dont know how to input any line breaks.

I\'ve tried to add \" {ln}{/ln}

11条回答
  •  一向
    一向 (楼主)
    2020-12-12 11:12

    The answers above were good:

    • the gsub (@Ian) worked well
    • the simple_format (@Karl) was a bit over the top as @Aaron pointed out, wrapping everything in

    So I tweaked as follows:

    simple_format(value, {}, wrapper_tag: 'div')
    

提交回复
热议问题