tabletop-companion/app/models/text_field.rb

14 lines
454 B
Ruby

# frozen_string_literal: true
class TextField < ApplicationRecord
has_one :character_sheet_feature, as: :featurable, dependent: :destroy
has_one :character_sheet_section, through: :character_sheet_feature
has_one :character, through: :character_sheet_section
accepts_nested_attributes_for :character_sheet_feature, allow_destroy: true
has_rich_text :content
validates :name, presence: true,
length: { maximum: 100 }
end