added uniqueness to dictionary

This commit is contained in:
Adrian Hinz 2022-06-29 11:59:00 +02:00
parent abbb95ecb7
commit dac061f9db
1 changed files with 2 additions and 2 deletions

View File

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