掲示板実装
Some checks failed
CI / scan_ruby (push) Has been cancelled
CI / scan_js (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
CI / system-test (push) Has been cancelled

This commit is contained in:
2026-02-19 22:30:59 +09:00
parent f25fd6f802
commit bb9ec2df1d
38 changed files with 1711 additions and 13 deletions

View File

@@ -1,19 +1,23 @@
class Participant < ApplicationRecord
belongs_to :user
belongs_to :game
has_many :board_memberships, dependent: :destroy
has_many :boards, through: :board_memberships
has_many :board_posts, dependent: :destroy
# バリデーション
validates :user_id, uniqueness: {
validates :user_id, uniqueness: {
scope: :game_id,
message: "既にこのゲームに参加しています"
}
validates :power, uniqueness: {
validates :power, uniqueness: {
scope: :game_id,
message: "この国は既に選択されています"
}, allow_nil: true
validates :power, inclusion: {
validates :power, inclusion: {
in: %w[AUSTRIA ENGLAND FRANCE GERMANY ITALY RUSSIA TURKEY],
message: "無効な国です"
}, allow_nil: true