【发布时间】:2015-09-09 14:09:40
【问题描述】:
我在before_filter 中有一些方法,我尝试渲染status: 403。然后我得到:
Missing template v1/examples/index, v1/base/index, application/index with {:locale=>[:en], :formats=>[:html, :text, :js, :css, :ics, :csv, :vcf, :png, :jpeg, :gif, :bmp, :tiff, :mpeg, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}.
但是,我可以渲染 nothing: true 或 text: 'some text' 而不会出现此错误。我做错了什么?
【问题讨论】:
-
发布代码。看起来您正在尝试呈现您没有的 403 页面。检查您的公用文件夹。
-
见鬼,我应该渲染空的 json hash + status...谢谢!
标签: ruby-on-rails ruby-on-rails-4 render status http-status