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