Module: Trek::Pages::Pathable

Extended by:
ActiveSupport::Concern
Included in:
Page
Defined in:
app/models/concerns/trek/pages/pathable.rb

Instance Method Summary collapse

Instance Method Details

#full_pathObject



34
35
36
# File 'app/models/concerns/trek/pages/pathable.rb', line 34

def full_path
  current_path.path
end

#full_path_from_treeObject



38
39
40
41
42
# File 'app/models/concerns/trek/pages/pathable.rb', line 38

def full_path_from_tree
  return "" if key == "root" # will be persisted by mobility as `nil`

  ([self] + ancestors).reject { |page| page.key == "root" }.reverse.map(&:slug).compact.join("/")
end