Added validation of cost_center if intern is selected

This commit is contained in:
2024-09-14 01:31:25 +02:00
parent 9cc7448d53
commit d6d8563af3

View File

@@ -5,6 +5,7 @@ class Job < ApplicationRecord
has_one_attached :pdf, dependent: :purge has_one_attached :pdf, dependent: :purge
validates_presence_of :costumer_firstname, :costumer_lastname, :pdf validates_presence_of :costumer_firstname, :costumer_lastname, :pdf
validates_presence_of :cost_center, if: :intern
validates :privacy_policy, acceptance: true, unless: :created_by_operator? validates :privacy_policy, acceptance: true, unless: :created_by_operator?
validates :number_of_plans_a0, :number_of_plans_a1, :number_of_plans_a2, :number_of_plans_a3, :costum_qm_plan, numericality: { greater_than_or_equal_to: 0 } validates :number_of_plans_a0, :number_of_plans_a1, :number_of_plans_a2, :number_of_plans_a3, :costum_qm_plan, numericality: { greater_than_or_equal_to: 0 }