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:
authorDouwe Maan <douwe@selenight.nl>2018-01-31 19:51:05 +0300
committerDouwe Maan <douwe@selenight.nl>2018-02-06 21:06:05 +0300
commit8d69436c901a3eee674e72c67d91de3994d30e0c (patch)
treec8071b0c0c78f2f711d51999793a2b66d9a9aea9 /app/models/namespace.rb
parent2d5f10b2a7f05b29ca5869b2d1acb53d5bcbf50b (diff)
Validate user namespace before saving so that errors persist on model
Diffstat (limited to 'app/models/namespace.rb')
-rw-r--r--app/models/namespace.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 06655298950..44c5bb13a59 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -20,6 +20,9 @@ class Namespace < ActiveRecord::Base
has_many :projects, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
has_many :project_statistics
+
+ # This should _not_ be `inverse_of: :namespace`, because that would also set
+ # `user.namespace` when this user creates a group with themselves as `owner`.
belongs_to :owner, class_name: "User"
belongs_to :parent, class_name: "Namespace"