tabletop-companion/app/models/table.rb

14 lines
427 B
Ruby
Raw Normal View History

2024-05-28 11:08:19 +00:00
# frozen_string_literal: true
class Table < ApplicationRecord
belongs_to :owner, class_name: "User"
belongs_to :game_system
validates :name, presence: true,
2024-05-28 19:22:08 +00:00
length: { maximum: 100 },
uniqueness: { scope: :owner_id, message: I18n.t("errors.unique_table_name") }
2024-05-28 11:08:19 +00:00
validates :slug, presence: true,
length: { maximum: 100 },
uniqueness: true
end