Handle ActiveRecord::RecordNotFound

This commit is contained in:
2018-02-05 10:42:21 -03:00
parent ba73f07a71
commit 38caf9b67c
+4
View File
@@ -10,6 +10,10 @@ module Dunlop::Ember::ApiBaseController
rescue_from CanCan::AccessDenied do rescue_from CanCan::AccessDenied do
render json: {errors: [{status: 403, detail: 'unauthorized'}]}, status: 403 render json: {errors: [{status: 403, detail: 'unauthorized'}]}, status: 403
end end
rescue_from ActiveRecord::RecordNotFound do
render json: {data: nil}, status: 404
end
end end
def index def index