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,7 +250,9 @@ class Namespace < ApplicationRecord ...@@ -250,7 +250,9 @@ class Namespace < ApplicationRecord
end end
def root_ancestor 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 end
def subgroup? 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