tabletop-companion/app/models/template.rb

15 lines
416 B
Ruby

# frozen_string_literal: true
class Template < ApplicationRecord
belongs_to :game_system
validates :name, presence: true,
uniqueness: { scope: :game_system_id },
length: { maximum: 200 }
validates :content, presence: true
validates :klass, presence: true,
length: { maximum: 200 }
scope :game_system, ->(game_system) { where(game_system:) }
end