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.
This commit is contained in:
parent
ebf289fded
commit
b8563dadc0
1 changed files with 3 additions and 1 deletions
|
@ -250,8 +250,10 @@ class Namespace < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def root_ancestor
|
def root_ancestor
|
||||||
|
strong_memoize(:root_ancestor) do
|
||||||
self_and_ancestors.reorder(nil).find_by(parent_id: nil)
|
self_and_ancestors.reorder(nil).find_by(parent_id: nil)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def subgroup?
|
def subgroup?
|
||||||
has_parent?
|
has_parent?
|
||||||
|
|
Loading…
Reference in a new issue