From dac061f9dbcffa63350c355e1c3b5cd07e7d6b04 Mon Sep 17 00:00:00 2001 From: Adrian Hinz Date: Wed, 29 Jun 2022 11:59:00 +0200 Subject: [PATCH] added uniqueness to dictionary --- app/models/dictionary.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/dictionary.rb b/app/models/dictionary.rb index 92fdb94..2314e61 100644 --- a/app/models/dictionary.rb +++ b/app/models/dictionary.rb @@ -11,8 +11,8 @@ class Dictionary < ApplicationRecord # == Relationships ======================================================== # == Validations ========================================================== - validates :name, presence: true, length: { maximum: 255 } - validates :shortcut, presence: true, length: { maximum: 50 } + validates :name, presence: true, length: { maximum: 255 }, uniqueness: true + validates :shortcut, presence: true, length: { maximum: 50 }, uniqueness: true validates :description, presence: true, length: { maximum: 1000 } # == Scopes =============================================================== scope :by_short, ->(val) { where(shortcut: val) }