From 552566dd2e3ac969ddec72e61e33e6d83575c71c Mon Sep 17 00:00:00 2001 From: Thor77 Date: Mon, 19 Nov 2018 14:57:55 +0100 Subject: [PATCH] Validate match has only 2 scores --- app/models/match.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/match.rb b/app/models/match.rb index 9b97a3d..54c1f66 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -4,4 +4,6 @@ class Match < ApplicationRecord belongs_to :stage belongs_to :group has_many :scores, dependent: :destroy + + validates :scores, length: { maximum: 2 } end