Added user model and fixed reference in migration

This commit is contained in:
2024-07-31 06:48:43 +02:00
parent ceafe1fe69
commit d322ba1a83
11 changed files with 98 additions and 75 deletions

View File

@@ -1,5 +1,5 @@
class JobsController < ApplicationController
before_action :set_job, only: %i[ show edit update destroy ]
before_action :set_job, only: %i[show edit update destroy]
# GET /jobs or /jobs.json
def index
@@ -7,8 +7,7 @@ class JobsController < ApplicationController
end
# GET /jobs/1 or /jobs/1.json
def show
end
def show; end
# GET /jobs/new
def new
@@ -16,8 +15,7 @@ class JobsController < ApplicationController
end
# GET /jobs/1/edit
def edit
end
def edit; end
# POST /jobs or /jobs.json
def create
@@ -25,7 +23,7 @@ class JobsController < ApplicationController
respond_to do |format|
if @job.save
format.html { redirect_to job_url(@job), notice: "Job was successfully created." }
format.html { redirect_to job_url(@job), notice: 'Job was successfully created.' }
format.json { render :show, status: :created, location: @job }
else
format.html { render :new, status: :unprocessable_entity }
@@ -38,7 +36,7 @@ class JobsController < ApplicationController
def update
respond_to do |format|
if @job.update(job_params)
format.html { redirect_to job_url(@job), notice: "Job was successfully updated." }
format.html { redirect_to job_url(@job), notice: 'Job was successfully updated.' }
format.json { render :show, status: :ok, location: @job }
else
format.html { render :edit, status: :unprocessable_entity }
@@ -52,19 +50,21 @@ class JobsController < ApplicationController
@job.destroy!
respond_to do |format|
format.html { redirect_to jobs_url, notice: "Job was successfully destroyed." }
format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_job
@job = Job.find(params[:id])
end
# Only allow a list of trusted parameters through.
def job_params
params.require(:job).permit(:operator_id_id, :costumer_id_id, :operator_firstname, :operator_lastname, :costumer_firstname, :costumer_lastname, :paid, :printed_at, :intern, :cost_center, :number_of_plans_a0, :number_of_plans_a1, :number_of_plans_a2, :number_of_plans_a3, :costum_qm_plan)
end
# Use callbacks to share common setup or constraints between actions.
def set_job
@job = Job.find(params[:id])
end
# Only allow a list of trusted parameters through.
def job_params
params.require(:job).permit(:operator_id, :costumer_id, :operator_firstname, :operator_lastname,
:costumer_firstname, :costumer_lastname, :paid, :printed_at, :intern, :cost_center, :number_of_plans_a0, :number_of_plans_a1, :number_of_plans_a2, :number_of_plans_a3, :costum_qm_plan)
end
end