Adjust validations for `List`

This commit is contained in:
Andreas Nedbal 2022-07-09 19:03:16 +02:00 committed by Karina Kwiatek
parent 69826eefe3
commit a3f80380dd
1 changed files with 3 additions and 1 deletions

View File

@ -6,7 +6,9 @@ class List < ApplicationRecord
belongs_to :user
has_many :list_members, dependent: :destroy
validates :name, length: { minimum: 1 }
validates :name,
length: { minimum: 1 },
uniqueness: { scope: :user_id }
validates :display_name, length: { maximum: 30 }
before_validation do