0
は私がERBファイルに印刷していた文字列レコード@user.location
を持っている、と私はそれが読みたい:SQL/Railsの文字列レコードに改行を挿入するにはどうしたらいいですか?
"first line
second line"
をこれまでのところ、私が試した:
@user.location = "first line" + "\n" + "second line"
@user.location = "first line" + '\n' + "second line"
@user.location = "first line" + "<br />" + "second line"
@user.location = "first line" + '<br />' + "second line"
@user.location = "first line
second line"
しかし、彼らすべて改行の代わりに文字通りの文字が表示されます。どうすればこれを達成できますか?
どこに出力しますか? 'puts"の最初の行でうまく動作します。\ n "+" 2行目 " – kirqe
@railsr' <%= @ user.location%> 'を書くだけで、erbで改行を出力する方法はありますか? ? –