module Ecom module Core class WorkPackage < ApplicationRecord belongs_to :project belongs_to :site_engineer, class_name: 'Ecom::Core::User', optional: true belongs_to :project_manager, class_name: 'Ecom::Core::User', optional: true validates :code, :name, presence: true validates :code, uniqueness: true validates :budget, numericality: true, unless: proc { budget.nil? } has_many :tasks end end end