Finish routes for projects
Some checks failed
CI / scan_ruby (push) Has been cancelled
CI / scan_js (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
CI / system-test (push) Has been cancelled

This commit is contained in:
2025-10-27 13:20:20 +01:00
parent 0dc4dd623d
commit 972d4c24ea
9 changed files with 73 additions and 2 deletions

View File

@@ -1,10 +1,48 @@
class ProjectsController < ApplicationController
before_action :set_project, only: %i[ show edit update destroy ]
def index
@projects = Project.all
end
def show
end
def new
@project = Project.new
end
def edit
end
def create
@project = Project.new(project_params)
if @project.save
redirect_to @project, notice: "Project successfully created."
else
render :new, status: :unprocessable_entity
end
end
def update
if @project.update(project_params)
redirect_to @project, notice: "Project successfully updated.", status: :see_other
else
render :edit, status: :unprocessable_entity
end
end
def destroy
@project.destroy!
redirect_to projects_path, notice: "Project successfully deleted.", status: :see_other
end
private
def set_project
@project = Project.find(params[:id])
end
def project_params
params.expect(project: [ :name ])
end
end