From 5d5ea8e302940016ee9b9d1baa74920faad322bc Mon Sep 17 00:00:00 2001 From: Trevor Vallender Date: Mon, 27 Nov 2023 07:53:55 +0000 Subject: [PATCH] Fix dependent relationships on Job --- app/models/job.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/job.rb b/app/models/job.rb index bcfa9a3..a118b04 100644 --- a/app/models/job.rb +++ b/app/models/job.rb @@ -7,8 +7,8 @@ class Job < ActiveRecord::Base presence: true belongs_to :project - has_many :time_entries, dependent: :restrict_with_error - has_many :time_budgets, dependent: :restrict_with_error + has_many :time_entries, dependent: :restrict_with_error, message: "You cannot delete a job with time logged against it." + has_many :time_budgets, dependent: :destroy accepts_nested_attributes_for :time_budgets, allow_destroy: true scope :project, ->(project) { where(project_id: project.id) }