Rails 5.1
removes a whole load of previously deprecated methods.其中有老朋友渲染:文字.
当您需要渲染一些文本但不想要视图模板的开销时,它非常有用.例子:
render text: "ok" render text: t('business_rules.project_access_denied'),status: 401
用什么代替?
解决方法
不推荐使用的方法是使用render:plain
Rails Guide on Layouts and Rendering:
2.2.6 Rendering Text
You can send plain text – with no markup at all – back to the browser by using the
:plain
option to render:06000
奖金
而不是渲染任何东西:真实(也被删除),现在应该使用head:ok.做同样的事情:发送http 200响应代码,只发送标题,没有内容.