Class: Refinery::Pages::FinderByScopedPath

Inherits:
FinderByPath show all
Defined in:
lib/refinery/pages/finder.rb

Instance Method Summary collapse

Methods inherited from FinderByPath

#initialize

Constructor Details

This class inherits a constructor from Refinery::Pages::FinderByPath

Instance Method Details

#findObject



119
120
121
122
123
124
125
126
127
128
# File 'lib/refinery/pages/finder.rb', line 119

def find
  # With slugs scoped to the parent page we need to find a page by its full path.
  # For example with about/example we would need to find 'about' and then its child
  # called 'example' otherwise it may clash with another page called /example.
  page = parent_page
  while page && path_segments.any? do
    page = next_page(page)
  end
  page
end