Skip to content
Snippets Groups Projects
Commit b8563dad authored by Adam Hegyi's avatar Adam Hegyi :coffee: Committed by Thong Kuah
Browse files

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
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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?
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment