summaryrefslogtreecommitdiff
path: root/app/models/namespace.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2018-01-31 10:51:05 -0600
committerDouwe Maan <douwe@selenight.nl>2018-02-06 12:06:05 -0600
commit8d69436c901a3eee674e72c67d91de3994d30e0c (patch)
treec8071b0c0c78f2f711d51999793a2b66d9a9aea9 /app/models/namespace.rb
parent2d5f10b2a7f05b29ca5869b2d1acb53d5bcbf50b (diff)
downloadgitlab-ce-8d69436c901a3eee674e72c67d91de3994d30e0c.tar.gz
Validate user namespace before saving so that errors persist on modeldm-user-namespace-route-path-validation
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"