Module: Namespaces::Traversal::Cached
Instance Method Summary
collapse
extended, extensions, included, method_added, override, prepended, queue_verification, verify!
Instance Method Details
#all_project_ids ⇒ Object
36
37
38
39
40
41
42
|
# File 'app/models/namespaces/traversal/cached.rb', line 36
def all_project_ids
scope_with_cached_ids(
all_projects.select(:id),
Project,
Namespaces::Descendants.arel_table[:all_project_ids]
)
end
|
#all_unarchived_project_ids ⇒ Object
45
46
47
48
49
50
51
|
# File 'app/models/namespaces/traversal/cached.rb', line 45
def all_unarchived_project_ids
scope_with_cached_ids(
all_projects.self_and_ancestors_non_archived.select(:id),
Project,
Namespaces::Descendants.arel_table[:all_unarchived_project_ids]
)
end
|
#descendant_ids(skope: self.class) ⇒ Object
31
32
33
|
# File 'app/models/namespaces/traversal/cached.rb', line 31
def descendant_ids(skope: self.class)
self_and_descendant_ids(skope:).id_not_in(id)
end
|
#self_and_descendant_ids(skope: self.class) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'app/models/namespaces/traversal/cached.rb', line 14
def self_and_descendant_ids(skope: self.class)
column_name = if skope == Namespace
:self_and_descendant_ids
elsif skope == self.class
:self_and_descendant_group_ids
end
return super unless column_name
scope_with_cached_ids(
super,
skope,
Namespaces::Descendants.arel_table[column_name]
)
end
|