From 161d7c02d4ff49d6d91b982faee61b5de00d2631 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 7 Dec 2016 19:15:26 +0200 Subject: Modify namespace name and path validation Currently namespace name and path have uniq validaiton which does not allow us to use same group name/path inside different groups. This commit changes validation in next way: * Allow same namespace name with different parent_id * Allow same namespace path. Uniq validation should be handled by routes table Signed-off-by: Dmitriy Zaporozhets --- app/models/namespace.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'app/models/namespace.rb') diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 37374044551..f0479d94986 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -17,14 +17,13 @@ class Namespace < ActiveRecord::Base validates :owner, presence: true, unless: ->(n) { n.type == "Group" } validates :name, presence: true, - uniqueness: true, + uniqueness: { scope: :parent_id }, length: { maximum: 255 }, namespace_name: true validates :description, length: { maximum: 255 } validates :path, presence: true, - uniqueness: { case_sensitive: false }, length: { maximum: 255 }, namespace: true -- cgit v1.2.3