diff options
Diffstat (limited to 'app/controllers/concerns/routable_actions.rb')
-rw-r--r-- | app/controllers/concerns/routable_actions.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/app/controllers/concerns/routable_actions.rb b/app/controllers/concerns/routable_actions.rb index e34d6b09c24..28e1fa473b3 100644 --- a/app/controllers/concerns/routable_actions.rb +++ b/app/controllers/concerns/routable_actions.rb @@ -46,13 +46,13 @@ module RoutableActions return unless request.get? canonical_path = routable.full_path - if canonical_path != routable_full_path - if !request.xhr? && request.format.html? && canonical_path.casecmp(routable_full_path) != 0 - flash[:notice] = "#{routable.class.to_s.titleize} '#{routable_full_path}' was moved to '#{canonical_path}'. Please update any links and bookmarks that may still have the old path." - end + return unless canonical_path != routable_full_path - redirect_to build_canonical_path(routable), status: :moved_permanently + if !request.xhr? && request.format.html? && canonical_path.casecmp(routable_full_path) != 0 + flash[:notice] = "#{routable.class.to_s.titleize} '#{routable_full_path}' was moved to '#{canonical_path}'. Please update any links and bookmarks that may still have the old path." end + + redirect_to build_canonical_path(routable), status: :moved_permanently end end |