Commit 6d867cad authored by Thong Kuah's avatar Thong Kuah

Merge branch 'memoize-namespace-root-ancestor' into 'master'

Memoizing root_ancestor in Namespace

See merge request gitlab-org/gitlab-ce!30248
parents ebf289fd b8563dad
......@@ -250,7 +250,9 @@ class Namespace < ApplicationRecord
end
def root_ancestor
self_and_ancestors.reorder(nil).find_by(parent_id: nil)
strong_memoize(:root_ancestor) do
self_and_ancestors.reorder(nil).find_by(parent_id: nil)
end
end
def subgroup?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment