return forbidden for forbidden json requests
This commit is contained in:
parent
2ea8124a01
commit
dbaded000f
1 changed files with 4 additions and 1 deletions
|
@ -4,7 +4,10 @@ class ApplicationController < ActionController::Base
|
|||
protect_from_forgery with: :exception
|
||||
|
||||
rescue_from CanCan::AccessDenied do |exception|
|
||||
redirect_to root_url, alert: exception.message
|
||||
respond_to do |format|
|
||||
format.json { render nothing: true, status: :forbidden }
|
||||
format.html { redirect_to root_url, alert: exception.message }
|
||||
end
|
||||
end
|
||||
|
||||
def authenticate_user_or_client!
|
||||
|
|
Loading…
Reference in a new issue