5

我有一些方法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: truetext: 'some text'不渲染此错误。我究竟做错了什么?

4

1 回答 1

15

没有您的代码很难说,但听起来您想要执行以下操作:

render json: {}, status: :forbidden
于 2015-09-09T14:26:13.393 回答