Skip to content

PagePath

Stable, translatable URLs for pages. Trek keeps every path a page has ever had, so old URLs keep working (redirecting to the current one) after a page is renamed or moved.

Columns

ColumnTypeNotes
page_idbigintrequired
pathjsonbtranslated full path (e.g. services/design)

Behavior

  • belongs_to :page — all historical paths of the page
  • has_one :current_page — the page this path is the current path for (via pages.current_path_id)
  • Includes Translatable — paths are localized per locale
  • Records are created and updated automatically by the page's after_save_commit callback; you never manage them by hand

See Pathable for the page-side API (full_path, find_at_full_path…).

Released under the MIT License.