【发布时间】:2014-07-09 16:11:32
【问题描述】:
我得到这个字符串,里面有'\n',我想显示一个新行,其中有'\n'而不是显示原始字符串
水果里面的描述
fruits.description: 'This is an red apple \n It is also very sweet'
我的渲染辅助方法
def get_description(fruits)
if fruits.type == 'apple'
haml_tag 'p', fruits.description, {id: fruits.id}
end
end
我希望字符串显示出来,就像这样
This is an red apple
It is also very sweet
【问题讨论】:
标签: html ruby-on-rails haml