tabletop-companion/app/models/text_field.rb

14 lines
454 B
Ruby
Raw Normal View History

2024-06-14 08:57:13 +00:00
# frozen_string_literal: true
class TextField < ApplicationRecord
2024-06-18 07:43:39 +00:00
has_one :character_sheet_feature, as: :featurable, dependent: :destroy
2024-06-17 13:53:09 +00:00
has_one :character_sheet_section, through: :character_sheet_feature
2024-06-21 09:57:03 +00:00
has_one :character, through: :character_sheet_section
2024-06-17 13:53:09 +00:00
accepts_nested_attributes_for :character_sheet_feature, allow_destroy: true
2024-06-14 08:57:13 +00:00
has_rich_text :content
validates :name, presence: true,
length: { maximum: 100 }
end