From ca5a81a85c9dfba8d61f790c755a822f51c0fa87 Mon Sep 17 00:00:00 2001 From: Alex Kriuchykhin Date: Mon, 22 Nov 2021 10:47:20 +0100 Subject: [PATCH] Add unique validation for user assignements [SCI-6279] (#3680) --- app/models/user_assignment.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/user_assignment.rb b/app/models/user_assignment.rb index fda354e47..4f21d82e5 100644 --- a/app/models/user_assignment.rb +++ b/app/models/user_assignment.rb @@ -7,4 +7,6 @@ class UserAssignment < ApplicationRecord belongs_to :assigned_by, class_name: 'User', optional: true enum assigned: { automatically: 0, manually: 1 }, _suffix: true + + validates :user, uniqueness: { scope: :assignable } end