Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Render status: 403 causes "Missing template" error

I have some method in before_filter and I try to render status: 403. then I get:

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]}.

I can however render nothing: true or text: 'some text' without this error. What am I doing wrong?

like image 515
ciembor Avatar asked Sep 09 '15 14:09

ciembor


1 Answers

Without your code it is hard to tell, but it sounds like you want to do the following:

render json: {}, status: :forbidden
like image 122
Antarr Byrd Avatar answered Nov 05 '22 16:11

Antarr Byrd