From b5192a89a9027fad5e8aebcb4fb3e7ba58c6d136 Mon Sep 17 00:00:00 2001 From: Vencislav Atanasov Date: Thu, 17 Nov 2016 18:46:40 +0200 Subject: [PATCH] Move method to a more appropriate place --- app/controllers/api/application_controller.rb | 5 ----- app/controllers/concerns/public_api_exposing.rb | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/controllers/api/application_controller.rb b/app/controllers/api/application_controller.rb index 461e1dc..b9568e7 100644 --- a/app/controllers/api/application_controller.rb +++ b/app/controllers/api/application_controller.rb @@ -1,7 +1,2 @@ class Api::ApplicationController < ::ApplicationController - def set_access_control_headers - if request.format.json? - response.headers['Access-Control-Allow-Origin'] = '*' - end - end end diff --git a/app/controllers/concerns/public_api_exposing.rb b/app/controllers/concerns/public_api_exposing.rb index 5fc08b8..17b541e 100644 --- a/app/controllers/concerns/public_api_exposing.rb +++ b/app/controllers/concerns/public_api_exposing.rb @@ -3,6 +3,12 @@ require 'active_support/concern' module PublicApiExposing extend ActiveSupport::Concern + def set_access_control_headers + if request.format.json? + response.headers['Access-Control-Allow-Origin'] = '*' + end + end + included do before_action :set_access_control_headers end