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