我在 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'
没有这个错误。我究竟做错了什么?
最佳答案
没有你的代码很难说,但听起来你想做以下事情:
render json: {}, status: :forbidden
关于ruby-on-rails - 渲染状态 : 403 causes "Missing template" error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32481878/