Add unique validation for user assignements [SCI-6279] (#3680)

This commit is contained in:
Alex Kriuchykhin 2021-11-22 10:47:20 +01:00 committed by GitHub
parent 8545b5787f
commit ca5a81a85c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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