Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-16 18:06:26 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-16 18:06:26 +0300
commit84727c8209a4412e21111a07f99b0438b03232de (patch)
tree1fcfa02b01548c3cdc561186870a1c807f227f0b /app/models/milestone.rb
parentd2798d607e11e0ebae83ae909404834388733428 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/milestone.rb')
-rw-r--r--app/models/milestone.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/app/models/milestone.rb b/app/models/milestone.rb
index 4b9fee2bbdf..800c492e8e2 100644
--- a/app/models/milestone.rb
+++ b/app/models/milestone.rb
@@ -27,11 +27,8 @@ class Milestone < ApplicationRecord
belongs_to :project
belongs_to :group
- # A one-to-one relationship is set up here as part of a MVC: https://gitlab.com/gitlab-org/gitlab-ce/issues/62402
- # However, on the long term, we will want a many-to-many relationship between Release and Milestone.
- # The "has_one through" allows us today to set up this one-to-one relationship while setting up the architecture for the long-term (ie intermediate table).
- has_one :milestone_release
- has_one :release, through: :milestone_release
+ has_many :milestone_releases
+ has_many :releases, through: :milestone_releases
has_internal_id :iid, scope: :project, init: ->(s) { s&.project&.milestones&.maximum(:iid) }
has_internal_id :iid, scope: :group, init: ->(s) { s&.group&.milestones&.maximum(:iid) }
@@ -68,7 +65,7 @@ class Milestone < ApplicationRecord
validate :milestone_type_check
validate :start_date_should_be_less_than_due_date, if: proc { |m| m.start_date.present? && m.due_date.present? }
validate :dates_within_4_digits
- validates_associated :milestone_release, message: -> (_, obj) { obj[:value].errors.full_messages.join(",") }
+ validates_associated :milestone_releases, message: -> (_, obj) { obj[:value].map(&:errors).map(&:full_messages).join(",") }
strip_attributes :title