From 0e06553494f994b07441552b6407b17d8cb7e905 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Fri, 12 Jan 2018 08:13:14 +0000 Subject: Merge branch 'mk-fix-permanent-redirect-validation' into 'master' Fix Route validation when conflicting permanent redirects exist Closes gitlab-com/support-forum#2883 and #41786 See merge request gitlab-org/gitlab-ce!16397 (cherry picked from commit d607f16fe5a1ec51eaea5811b5118b1ba48acfbc) 1dc30595 Revert "Revert "Fix Route validation for unchanged path"" c517788e Fix Rubocop offense 601c24d5 Add RedirectRoute factory d4c8d1b7 Add changelog entry --- 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 7ba3ec06041..412f5fb45a5 100644 --- a/app/models/route.rb +++ b/app/models/route.rb @@ -8,7 +8,7 @@ class Route < ActiveRecord::Base presence: true, uniqueness: { case_sensitive: false } - validate :ensure_permanent_paths + validate :ensure_permanent_paths, if: :path_changed? after_create :delete_conflicting_redirects after_update :delete_conflicting_redirects, if: :path_changed? -- cgit v1.2.1