Make the uniqueness of the name of a group expicit in the model

This commit is contained in:
Patrick Gansterer 2019-11-11 11:12:27 +01:00
parent eb8241cf04
commit db4c29ff1b
1 changed files with 1 additions and 0 deletions

View File

@ -9,6 +9,7 @@ class Group < ApplicationRecord
has_many :users, -> { where(deleted_at: nil) }, through: :memberships
validates :name, :presence => true, :length => {:in => 1..25}
validates_uniqueness_of :name
attr_reader :user_tokens