tabletop-companion/app/models/counter.rb

15 lines
384 B
Ruby

# frozen_string_literal: true
class Counter < ApplicationRecord
include Sluggable
belongs_to :character_sheet_section
validates :name, presence: true,
length: { maximum: 100 },
uniqueness: { scope: :character_sheet_section_id }
validates :value, presence: true,
numericality: true
before_validation :set_slug
end