From 95e0fac59ae8174d11873e95a3ef579af476f215 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 19 Dec 2016 22:36:47 +0200 Subject: Fix Route#rename_children behavior Given group `gitlab` and `gitlab-org` exists. When rename `gitlab` it will rename `gitlab-org` group route too. This commit fixes it Signed-off-by: Dmitriy Zaporozhets --- app/models/route.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/models/route.rb') diff --git a/app/models/route.rb b/app/models/route.rb index d40214b9da6..caf596efa79 100644 --- a/app/models/route.rb +++ b/app/models/route.rb @@ -13,7 +13,7 @@ class Route < ActiveRecord::Base def rename_children # We update each row separately because MySQL does not have regexp_replace. # rubocop:disable Rails/FindEach - Route.where('path LIKE ?', "#{path_was}%").each do |route| + Route.where('path LIKE ?', "#{path_was}/%").each do |route| # Note that update column skips validation and callbacks. # We need this to avoid recursive call of rename_children method route.update_column(:path, route.path.sub(path_was, path)) -- cgit v1.2.1