13 lines
368 B
Ruby
13 lines
368 B
Ruby
# frozen_string_literal: true
|
|
|
|
class CharacterSheetSection < ApplicationRecord
|
|
belongs_to :character
|
|
belongs_to :parent_section, optional: true
|
|
has_many :character_sheet_subsections, class_name: "CharacterSheetSection"
|
|
|
|
validates :name, presence: true,
|
|
length: { maximum: 255 }
|
|
|
|
scope :top_level, -> { where.missing(:parent_section) }
|
|
end
|