diff --git a/app/controllers/locations_controller.rb b/app/controllers/locations_controller.rb index 2bb9d6c89..f57fb6b4d 100644 --- a/app/controllers/locations_controller.rb +++ b/app/controllers/locations_controller.rb @@ -70,7 +70,9 @@ class LocationsController < ApplicationController when "edit-name" redirect_to(scheme_check_answers_path(@scheme, anchor: "locations")) when "edit-local-authority" - @add_another_location = nil&.(CGI.parse(URI.parse(request.referrer).query)['add_another_location'].first) + @uri_query = URI.parse(request.referer).query + @query_hash = @uri_query ? CGI.parse(@uri_query) : { "add_another_location": [] } + @add_another_location = @query_hash["add_another_location"].try(:first) if @add_another_location == "Yes" redirect_to(new_location_path(@location.scheme)) else