tabletop-companion/app/models/table.rb

14 lines
427 B
Ruby

# frozen_string_literal: true
class Table < ApplicationRecord
belongs_to :owner, class_name: "User"
belongs_to :game_system
validates :name, presence: true,
length: { maximum: 100 },
uniqueness: { scope: :owner_id, message: I18n.t("errors.unique_table_name") }
validates :slug, presence: true,
length: { maximum: 100 },
uniqueness: true
end