tabletop-companion/app/models/counter.rb

13 lines
445 B
Ruby

# frozen_string_literal: true
class Counter < ApplicationRecord
has_one :character_sheet_feature, as: :featurable, dependent: :destroy
has_one :character_sheet_section, through: :character_sheet_feature
accepts_nested_attributes_for :character_sheet_feature, allow_destroy: true
validates :name, presence: true,
length: { maximum: 100 }
validates :value, presence: true,
numericality: true
end