added uniqueness to dictionary
This commit is contained in:
parent
abbb95ecb7
commit
dac061f9db
|
|
@ -11,8 +11,8 @@ class Dictionary < ApplicationRecord
|
||||||
# == Relationships ========================================================
|
# == Relationships ========================================================
|
||||||
|
|
||||||
# == Validations ==========================================================
|
# == Validations ==========================================================
|
||||||
validates :name, presence: true, length: { maximum: 255 }
|
validates :name, presence: true, length: { maximum: 255 }, uniqueness: true
|
||||||
validates :shortcut, presence: true, length: { maximum: 50 }
|
validates :shortcut, presence: true, length: { maximum: 50 }, uniqueness: true
|
||||||
validates :description, presence: true, length: { maximum: 1000 }
|
validates :description, presence: true, length: { maximum: 1000 }
|
||||||
# == Scopes ===============================================================
|
# == Scopes ===============================================================
|
||||||
scope :by_short, ->(val) { where(shortcut: val) }
|
scope :by_short, ->(val) { where(shortcut: val) }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue