From 34fbf1472c0d0f39d794c56e3570d158b29381ff Mon Sep 17 00:00:00 2001 From: Bertocq Date: Tue, 3 Oct 2017 12:26:04 +0200 Subject: [PATCH] Join in a single validation both Shift date validates statements --- app/models/poll/shift.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/models/poll/shift.rb b/app/models/poll/shift.rb index cc5f7045e..7fc5e09d1 100644 --- a/app/models/poll/shift.rb +++ b/app/models/poll/shift.rb @@ -5,9 +5,8 @@ class Poll validates :booth_id, presence: true validates :officer_id, presence: true - validates :date, presence: true + validates :date, presence: true, uniqueness: { scope: [:officer_id, :booth_id, :task] } validates :task, presence: true - validates :date, uniqueness: { scope: [:officer_id, :booth_id, :task] } enum task: { vote_collection: 0, recount_scrutiny: 1 }