summaryrefslogtreecommitdiff
path: root/app/models/route.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-12-19 22:36:47 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-12-19 22:36:47 +0200
commit95e0fac59ae8174d11873e95a3ef579af476f215 (patch)
tree4e8d9dbcc8190911a7727f658b60799181f79cc4 /app/models/route.rb
parenta50cd9eb4b4392004e47e57b2fa37c12def5827f (diff)
downloadgitlab-ce-95e0fac59ae8174d11873e95a3ef579af476f215.tar.gz
Fix Route#rename_children behaviordz-fix-route-rename
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 <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/route.rb')
-rw-r--r--app/models/route.rb2
1 files changed, 1 insertions, 1 deletions
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))