a11yist/app/models/page.rb
david 42c077f6ab
Some checks failed
/ Run tests (push) Failing after 1m9s
/ Run system tests (push) Failing after 1m13s
/ Build, push and deploy image (push) Has been skipped
Gui improvements, ordering
2024-11-01 03:26:46 +01:00

13 lines
262 B
Ruby

class Page < ApplicationRecord
belongs_to :report
has_many :elements, dependent: :destroy
has_rich_text :comment
before_validation :set_position
private
def set_position
self.position ||= (report.pages.pluck(:position).max || 0) + 1
end
end