tabletop-companion/app/models/counter.rb

13 lines
445 B
Ruby
Raw Normal View History

2024-06-12 15:17:27 +00:00
# frozen_string_literal: true
class Counter < 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
accepts_nested_attributes_for :character_sheet_feature, allow_destroy: true
2024-06-12 15:17:27 +00:00
validates :name, presence: true,
2024-06-17 13:53:09 +00:00
length: { maximum: 100 }
2024-06-12 15:17:27 +00:00
validates :value, presence: true,
numericality: true
end