Ensure AR not found errors are handled in API
This commit is contained in:
@@ -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'] :
|
||||
|
@@ -1,7 +0,0 @@
|
||||
module API
|
||||
class ErrorsController < ApplicationController
|
||||
def not_found
|
||||
head :not_found
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user