diff --git a/app/controllers/locations_controller.rb b/app/controllers/locations_controller.rb index 6a8a8b499..115727efd 100644 --- a/app/controllers/locations_controller.rb +++ b/app/controllers/locations_controller.rb @@ -7,9 +7,22 @@ class LocationsController < ApplicationController @location = Location.new end + def create + debugger + @scheme = Scheme.find(params[:id]) + @location = Location.new(location_params) + @location.save + render "schemes/check_answers" + end + private def authenticate_scope! head :unauthorized and return unless current_user.data_coordinator? || current_user.support? end + + def location_params + required_params = params.require(:location).permit(:postcode, :name, :total_units, :type_of_unit, :wheelchair_adaptation, :add_another_location).merge(scheme_id: @scheme.id) + required_params + end end diff --git a/app/views/locations/new.html.erb b/app/views/locations/new.html.erb index 7b5a4ea4f..f867d1916 100644 --- a/app/views/locations/new.html.erb +++ b/app/views/locations/new.html.erb @@ -39,7 +39,7 @@ <% wheelchair_user_selection = Location.wheelchair_adaptations.keys.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } %> - <%= f.govuk_collection_radio_buttons :type_of_unit, + <%= f.govuk_collection_radio_buttons :wheelchair_adaptation, wheelchair_user_selection, :id, :name,