Fix dependent relationships on Job

This commit is contained in:
Trevor Vallender 2023-11-27 07:53:55 +00:00
parent d83c3b3e48
commit 5d5ea8e302
1 changed files with 2 additions and 2 deletions

View File

@ -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) }