尝试
<%= simple_format @template.about %>
http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#method-i-simple_format
这个对我有用 :-\
1.9.3p194 :017 > str = "Thanks for the fish, guys! Not like I wanted it, but... uh... thanks?
1.9.3p194 :018"> \"I'll be the judge of that,\" he said!
1.9.3p194 :019"> And now, more useless copy so I can isolate that weird bud that Amanda found.
1.9.3p194 :020"> Wait! I meant 'weird bug..."
#=> "Thanks for the fish, guys! Not like I wanted it, but... uh... thanks? \n\"I'll be the judge of that,\" he said! \nAnd now, more useless copy so I can isolate that weird bud that Amanda found. \nWait! I meant 'weird bug..."
1.9.3p194 :021 > simple_format str
#=> "<p>Thanks for the fish, guys! Not like I wanted it, but... uh... thanks? \n<br />\"I'll be the judge of that,\" he said! \n<br />And now, more useless copy so I can isolate that weird bud that Amanda found. \n<br />Wait! I meant 'weird bug...</p>"
或使用gsub
1.9.3p194 :022 > str.gsub("\n", "<br />")
#=> "Thanks for the fish, guys! Not like I wanted it, but... uh... thanks? <br />\"I'll be the judge of that,\" he said! <br />And now, more useless copy so I can isolate that weird bud that Amanda found. <br />Wait! I meant 'weird bug..."