Skip to content

Commit 1b7880d

Browse files
authored
Merge pull request #18897 from danidoni/add-uniqueness-validation-to-attrib-type-modifiable-by-model
Add uniqueness validation to AttribTypeModifiableBy
2 parents e0d7a70 + b3cda7f commit 1b7880d

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/api/.database_consistency.todo.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ AttribTypeModifiableBy:
5959
attrib_type:
6060
ForeignKeyChecker:
6161
enabled: false
62-
attrib_type_user_role_all_index:
63-
UniqueIndexChecker:
64-
enabled: false
6562
id:
6663
PrimaryKeyTypeChecker:
6764
enabled: false

src/api/app/models/attrib_type_modifiable_by.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ class AttribTypeModifiableBy < ApplicationRecord
33
belongs_to :user, optional: true
44
belongs_to :group, optional: true
55
belongs_to :role, optional: true
6+
7+
validates :attrib_type, uniqueness: { scope: %i[user group role] }
68
end
79

810
# == Schema Information

0 commit comments

Comments
 (0)