2019-12-04 20:38:33 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class MilestoneRelease < ApplicationRecord
|
2021-03-11 19:13:27 +05:30
|
|
|
extend SuppressCompositePrimaryKeyWarning
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
belongs_to :milestone
|
|
|
|
belongs_to :release
|
|
|
|
|
|
|
|
validate :same_project_between_milestone_and_release
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def same_project_between_milestone_and_release
|
|
|
|
return if milestone&.project_id == release&.project_id
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
return if milestone&.group_id
|
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
errors.add(:base, _('Release does not have the same project as the milestone'))
|
2019-12-04 20:38:33 +05:30
|
|
|
end
|
|
|
|
end
|
2021-01-03 14:25:43 +05:30
|
|
|
|
|
|
|
MilestoneRelease.prepend_if_ee('EE::MilestoneRelease')
|