Skip to content

Commit 7198567

Browse files
author
jamesprior
committed
Preload ancestor nodes
1 parent d2b7e4e commit 7198567

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/cms/concerns/can_be_addressable.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,7 @@ def page_title
224224
#
225225
def ancestors(options={})
226226
return [] unless node
227-
ancestor_nodes = node.ancestors
228-
ancestors = ancestor_nodes.collect { |node| node.node }
227+
ancestors = node.ancestors.includes(:node).collect(&:node)
229228
ancestors << self if options[:include_self]
230229
ancestors
231230
end

0 commit comments

Comments
 (0)