Ensure AR not found errors are handled in API

This commit is contained in:
Thibault Jouan
2015-05-01 20:51:40 +00:00
parent cd73a588b0
commit 5b9d36cb39
4 changed files with 14 additions and 9 deletions

View File

@@ -1,11 +1,17 @@
module API
class ApplicationController < ::ApplicationController
rescue_from ActiveRecord::RecordNotFound, with: :not_found
skip_before_filter :verify_authenticity_token
skip_before_filter :authenticate!, only: :cor_preflight
before_filter :cor_filter
before_filter :json_filter!
def not_found
head :not_found
end
def cor_filter
headers['Access-Control-Allow-Origin'] = request.headers['Origin'] ?
request.headers['Origin'] :

View File

@@ -1,7 +0,0 @@
module API
class ErrorsController < ApplicationController
def not_found
head :not_found
end
end
end