我试图在我的控制器中渲染以下内容:
User-agent: *
Disallow: /
目前它看起来像这样:
User-agent: *Disallow: /
def robots
output = "User-agent: *\nDisallow: /" #this is wrong I know...
render text: output
end
如何添加换行符?
答案 0 :(得分:1)
确保使用双引号render :text => "User-agent: *\nDisallow: /"