2023-11-24 15:05:38 +00:00
|
|
|
class TimeBudget < ActiveRecord::Base
|
|
|
|
validates :hours,
|
|
|
|
presence: true
|
|
|
|
|
|
|
|
validates :activity_id,
|
2023-11-24 16:51:15 +00:00
|
|
|
inclusion: { in: TimeEntryActivity.pluck(:id) },
|
|
|
|
allow_nil: true
|
|
|
|
|
|
|
|
validates_uniqueness_of :job_id, scope: :activity_id, message: "Only one time budget can exist for each activity type"
|
2023-11-24 15:05:38 +00:00
|
|
|
|
|
|
|
belongs_to :job
|
|
|
|
belongs_to :activity, class_name: "TimeEntryActivity"
|
|
|
|
end
|