Page
Hierarchical, translatable content pages with SEO metadata, versioning and stable URL paths. Generated into app/models/page.rb.
Columns
| Column | Type | Notes |
|---|---|---|
key | string | internal identifier, optional |
slug | jsonb | translated URL slug |
title | jsonb | translated title |
description | jsonb | translated description |
content | jsonb | ProseMirror document |
pageable_type / pageable_id | string / bigint | polymorphic link to a content model |
parent_id | bigint | tree hierarchy |
position | integer | ordering among siblings |
image_data | jsonb | Shrine attachment |
versioned | boolean | enables versioning, default false |
sectioned | boolean | enables sections, default false |
current_path_id | bigint | current PagePath |
Included concerns
Translatable (slug, title, description), Formattable, Contentable, Fragmentable, Orderable, Pathable, SearchEngineOptimizable, Sectionable, Sluggable, Versionable, Keyable, plus RecordImageUploader::Attachment(:image) and strip_attributes.
Associations
has_closure_tree— parent/children hierarchy (siblings, ancestors, descendants)belongs_to :pageable, polymorphic: true, optional: true— the content model this page represents (see Pageable)has_many :versions→ PageVersionhas_many :pathsandbelongs_to :current_path→ PagePathhas_many :menu_nodes, as: :linkable→ MenuNode
Validations & scopes
titlepresence;slugpresence (unless root) and uniqueness within the parentalpha_ordered— orders by translated title in the current locale
Notable methods
| Method | Returns |
|---|---|
full_path | the page's current URL path |
find_at_full_path(path) | class method — page lookup by path |
parsed_content / formatted_content / content_text | ProseMirror content as hash / HTML / plain text |
current_version / current_content / current_image | versioned content accessors |
seo_values / meta_tags | SEO metadata with fallbacks |
fragments | the fragments attached to this page key |