From 42ec8a7c3de2c4b1895b24505c39cfab4b601d02 Mon Sep 17 00:00:00 2001 From: zachGlasgow Date: Thu, 9 Jun 2016 08:52:42 +0100 Subject: [PATCH] Add constraints to remove dots from username. (#4255) Rails is using dots as a separator for formatted routes. As a result if the username has more than one dot it will not match the route. Bug raised here -> https://meta.discourse.org/t/refreshing-a-users-detail-page-in-admin-doesnt-work-in-some-cases/44891 --- config/routes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index f7839f043b1..717fe6da517 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -115,7 +115,7 @@ Discourse::Application.routes.draw do post "reset_bounce_score" end get "users/:id.json" => 'users#show', defaults: {format: 'json'} - get 'users/:id/:username' => 'users#show' + get 'users/:id/:username' => 'users#show', constraints: {username: USERNAME_ROUTE_FORMAT} get 'users/:id/:username/badges' => 'users#show'