class FeedsController < ApplicationController
  enable_request_formats organisation: :atom

  def organisation
    set_access_control_allow_origin_header if request.format.atom?

    path = "/government/organisations/#{organisation_name}#{locale}"
    @organisation = Organisation.find!(path)

    results = Feeds::FeedContent.new(filter_organisations: organisation_name).results
    @items = results.map { |result| Feeds::FeedEntryPresenter.new(result) }
  end

private

  # allows ajax requests as per https://govuk.zendesk.com/agent/tickets/1935680
  def set_access_control_allow_origin_header
    response.headers["Access-Control-Allow-Origin"] = "*"
  end

  def organisation_name
    params[:organisation_name]
  end

  def locale
    ".#{params[:locale]}" if params[:locale]
  end
end

class FeedsController < ApplicationController
  enable_request_formats organisation: :atom

  before_action do
    # Allows ajax requests as per https://govuk.zendesk.com/agent/tickets/1935680
    if request.format.atom?
      response.headers["Access-Control-Allow-Origin"] = "*"
    end
  end

  def organisation
    path = "/government/organisations/#{organisation_name}#{locale}"
    @organisation = Organisation.find!(path)

    results = Feeds::FeedContent.new(filter_organisations: organisation_name).results
    @items = results.map { |result| Feeds::FeedEntryPresenter.new(result) }
  end

private

  def organisation_name
    params[:organisation_name]
  end

  def locale
    ".#{params[:locale]}" if params[:locale]
  end
end

Move CORS headers to before_action
Move CORS headers to before_action

This way new method will also be able to use this controller.
