ruby on rails 输出http状态

官网的例子中只是给出了

render :status => (status code),

实际中,我这么写:

format.html { render :stauts => 200 }

rails 报错了,提示没哟模板文件, format.html 是需要有模板匹配的,但可以添加  :nothing 选项

format.htm { render :nothing => 200, :nothing => true }

这样子就不要模板了

原文地址:https://www.cnblogs.com/wws19125/p/3060712.html