提交 b8563dad 编写于 作者: A Adam Hegyi 提交者: 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.
上级 ebf289fd
......@@ -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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册