From 7aeefd52bf64d0b13f47c1f3c432bab6fe8d8f9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20B=C3=B6hm?= Date: Mon, 9 Sep 2024 15:08:49 +0200 Subject: [PATCH] Created operator reference when new job is created --- app/controllers/jobs_controller.rb | 1 + app/controllers/operator/jobs_controller.rb | 2 ++ 2 files changed, 3 insertions(+) diff --git a/app/controllers/jobs_controller.rb b/app/controllers/jobs_controller.rb index 73a4cc3..a4734bf 100644 --- a/app/controllers/jobs_controller.rb +++ b/app/controllers/jobs_controller.rb @@ -13,6 +13,7 @@ class JobsController < ApplicationController # POST /jobs or /jobs.json def create @job = Job.new(job_params) + @job.costumer = current_user respond_to do |format| if @job.save diff --git a/app/controllers/operator/jobs_controller.rb b/app/controllers/operator/jobs_controller.rb index fd36eff..7574fd9 100644 --- a/app/controllers/operator/jobs_controller.rb +++ b/app/controllers/operator/jobs_controller.rb @@ -21,6 +21,8 @@ class Operator::JobsController < ApplicationController def create @job = Job.new(job_params) @job.created_by_operator = true + # TODO: rename costumer to creater? When created by operator the operator is referenced instead of costumer. + @job.costumer = current_user respond_to do |format| if @job.save