1
0
This repository has been archived on 2023-12-07. You can view files and clone it, but cannot push or open issues or pull requests.
2020-08-06 21:52:33 +02:00

15 lines
547 B
Ruby

class Goal < ActiveRecord::Base
belongs_to :project, required: true
has_many :targets, -> { order "effective_from DESC" }, inverse_of: :goal,
dependent: :destroy, extend: BodyTracking::ItemsWithQuantities
has_many :target_exposures, as: :view, dependent: :destroy,
class_name: 'Exposure', extend: BodyTracking::TogglableExposures
has_many :quantities, -> { order "lft" }, through: :target_exposures
validates :name, presence: true, uniqueness: {scope: :project_id}
def is_binding?
self == project.goals.binding
end
end