integration of the new MVC for subproject_addresses

This commit is contained in:
Stefan Tollkühn
2025-07-22 17:33:53 +02:00
parent bae8b9318d
commit bc0df35259
11 changed files with 176 additions and 1 deletions

View File

@@ -0,0 +1,49 @@
class SubprojectAddressesController < ApplicationController
before_action :set_subproject_address, only: %i[show edit update destroy]
def index
@subproject_addresses = SubprojectAddress.all
end
def show
end
def new
@subproject_address = SubprojectAddress.new
end
def edit
end
def create
@subproject_address = SubprojectAddress.new(subproject_address_params)
if @subproject_address.save
redirect_to @subproject_address, notice: "Adresse was successfully created."
else
render :new, status: :unprocessable_entity
end
end
def update
if @subproject_address.update(subproject_address_params)
redirect_to @subproject_address, notice: "Adresse was successfully updated."
else
render :edit, status: :unprocessable_entity
end
end
def destroy
@subproject_address.destroy
redirect_to subproject_addresses_url, notice: "Adresse was successfully destroyed."
end
private
def set_subproject_address
@subproject_address = SubprojectAddress.find(params[:id])
end
def subproject_address_params
params.require(:subproject_address).permit(:subproject_id, :streetname, :zipcode, :city, :country)
end
end