Commit b8563dad authored by Adam Hegyi's avatar Adam Hegyi Committed by Thong Kuah

Memoizing root_ancestor in Namespace

The root_ancestor method is heavily used in EE for the group_saml
feature. Having this memoization implemented in CE would eliminate
the need of overriding the root_ancestor method in EE.
parent ebf289fd
......@@ -250,8 +250,10 @@ class Namespace < ApplicationRecord
end
def root_ancestor
strong_memoize(:root_ancestor) do
self_and_ancestors.reorder(nil).find_by(parent_id: nil)
end
end
def subgroup?
has_parent?
......
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