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:
authorLin Jen-Shin <godfat@godfat.org>2018-06-26 12:58:51 +0300
committerLin Jen-Shin <godfat@godfat.org>2018-06-26 12:58:51 +0300
commitd5a1910f0ce24cf88bc7f0279904a8d5088e2ffa (patch)
tree735aa5278bd547f8d83d6cfbb92e9aef4681a9c7 /app/models/namespace.rb
parent2024522b51ae672df3b04ec0ed3d17eefcb45264 (diff)
Port Namespace#root_ancestor to CE
Diffstat (limited to 'app/models/namespace.rb')
-rw-r--r--app/models/namespace.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 52fe529c016..7034c633268 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -228,6 +228,10 @@ class Namespace < ActiveRecord::Base
parent.present?
end
+ def root_ancestor
+ ancestors.reorder(nil).find_by(parent_id: nil)
+ end
+
def subgroup?
has_parent?
end