HTMLエスケープして改行をbrに変換
上記のcssハックでも折り返しできない場合はhttp://d.hatena.ne.jp/koseki2/20070415/hbrが参考になる。
application_helper.rbに追加する用。
def hbr(str) str = html_escape(str) str.gsub(/\r\n|\r|\n/, "<br />") end
VIEW側では<%=hbr textarea_value %>のように使う。
上記のcssハックでも折り返しできない場合はhttp://d.hatena.ne.jp/koseki2/20070415/hbrが参考になる。
application_helper.rbに追加する用。
def hbr(str) str = html_escape(str) str.gsub(/\r\n|\r|\n/, "<br />") end
VIEW側では<%=hbr textarea_value %>のように使う。