diff --git a/app/controllers/locations_controller.rb b/app/controllers/locations_controller.rb index 532ab915a..1759ac1d6 100644 --- a/app/controllers/locations_controller.rb +++ b/app/controllers/locations_controller.rb @@ -23,9 +23,9 @@ class LocationsController < ApplicationController @location = Location.new(location_params) if @location.save if @location.location_admin_district.nil? - redirect_to(location_edit_local_authority_path(id: @scheme.id, location_id: @location.id, add_another_location: location_params[:add_another_location])) + redirect_to(edit_local_authority_scheme_location_path(scheme_id: @scheme.id, id: @location.id, add_another_location: location_params[:add_another_location])) elsif location_params[:add_another_location] == "Yes" - redirect_to new_location_path(@scheme) + redirect_to new_scheme_location_path(@scheme) else check_answers_path = @scheme.confirmed? ? scheme_check_answers_path(@scheme, anchor: "locations") : scheme_check_answers_path(@scheme) redirect_to check_answers_path @@ -71,7 +71,7 @@ class LocationsController < ApplicationController if @location.location_admin_district.nil? redirect_to(location_edit_local_authority_path(id: @scheme.id, location_id: @location.id, add_another_location: location_params[:add_another_location])) elsif location_params[:add_another_location] == "Yes" - redirect_to(new_location_path(@location.scheme)) + redirect_to(new_scheme_location_path(@location.scheme)) else redirect_to(scheme_check_answers_path(@scheme, anchor: "locations")) end @@ -79,7 +79,7 @@ class LocationsController < ApplicationController redirect_to(scheme_check_answers_path(@scheme, anchor: "locations")) when "edit-local-authority" if params[:add_another_location] == "Yes" - redirect_to(new_location_path(@location.scheme)) + redirect_to(new_scheme_location_path(@location.scheme)) else redirect_to(scheme_check_answers_path(@scheme, anchor: "locations")) end @@ -107,7 +107,7 @@ private def find_scheme @scheme = if %w[new create index edit_name].include?(action_name) - Scheme.find(params[:id]) + Scheme.find(params[:scheme_id]) else @location&.scheme end diff --git a/app/controllers/schemes_controller.rb b/app/controllers/schemes_controller.rb index d4168e355..9a259e3a1 100644 --- a/app/controllers/schemes_controller.rb +++ b/app/controllers/schemes_controller.rb @@ -176,7 +176,7 @@ private when "secondary-client-group" scheme_support_path(@scheme) when "support" - new_location_path + new_scheme_location_path(@scheme) when "details" if @scheme.arrangement_type_before_type_cast == "D" scheme_primary_client_group_path(@scheme) diff --git a/app/helpers/check_answers_helper.rb b/app/helpers/check_answers_helper.rb index b334ab073..0be14641c 100644 --- a/app/helpers/check_answers_helper.rb +++ b/app/helpers/check_answers_helper.rb @@ -18,14 +18,14 @@ module CheckAnswersHelper def get_location_change_link_href_postcode(scheme, location) if location.confirmed? - location_edit_name_path(id: scheme.id, location_id: location.id) + edit_name_scheme_location_path(scheme_id: scheme.id, id: location.id) else - location_edit_path(id: scheme.id, location_id: location.id) + edit_scheme_location_path(scheme_id: scheme.id, id: location.id) end end def get_location_change_link_href_location_admin_district(scheme, location) - location_edit_local_authority_path(id: scheme.id, location_id: location.id) + edit_local_authority_scheme_location_path(scheme_id: scheme.id, id: location.id) end def any_questions_have_summary_card_number?(subsection, lettings_log) diff --git a/app/views/locations/edit.html.erb b/app/views/locations/edit.html.erb index 6e14503ed..dca0d04fb 100644 --- a/app/views/locations/edit.html.erb +++ b/app/views/locations/edit.html.erb @@ -7,7 +7,7 @@ ) %> <% end %> -<%= form_for(@location, method: :patch, url: location_path(@location)) do |f| %> +<%= form_for(@location, method: :patch, url: scheme_location_path(scheme_id: @scheme.id, id: @location.id)) do |f| %>