PageVersion
Version history for pages: every snapshot of a versioned page's content and image. There is always exactly one current version per page; the others are archived.
Columns
| Column | Type | Notes |
|---|---|---|
page_id | bigint | required |
name | string | version label, auto-generated from the page title and date |
content | jsonb | ProseMirror content snapshot |
image_data | jsonb | Shrine attachment snapshot |
current_since | datetime | set ⇔ this is the current version |
Behavior
belongs_to :page— withPage#versionsordered most recent first- Validations guarantee one and only one current version per page
after_initializesets a default name like"Page title (2026-06-10)"- Includes Sectionable,
RecordImageUploader::Attachment(:image)andstrip_attributes
Notable methods
| Method | Returns |
|---|---|
current? | whether this version is the live one |
other_versions | the page's other versions |
current_image / current_image_url | this version's image |
See Versionable for the page-side API (create_current_version_from_page!, current_content…).