sta*_*lei 12 ruby-on-rails render http-status-codes
Rails render head :ok与vs. 之间有什么区别render status :ok?它们都作为标题返回了吗?
render head :ok
render status :ok
Cyz*_*far 14
真的没有区别.在Rails的文档说,这大概head:
head
head方法可用于向浏览器发送仅包含标头的响应.head方法接受表示HTTP状态代码的数字或符号(请参阅参考表)
head :ok 将render设置为仅返回状态为200的标头.
head :ok
这只是一个简写render nothing: true, status: :ok.
render nothing: true, status: :ok
head :no_content如果没有为操作定义模板,Rails 5也会默认执行
head :no_content
归档时间:
7 年,12 月 前
查看次数:
4645 次
最近记录: