Rails Routes: Devise Usernames with multiple dots

115 Views Asked by At

I am running into issues where the incorrect id is passed to a controller when a username has multiple dots

For example, when loading the path="/users/rong.xu.wh06"

It passes the id Parameters: {"id"=>"rong.xu"}

This is what I have in my routes:

resources :users, :id => /[A-Za-z0-9\-\_\.\+]+?/ do

How do I resolve this issue?

By the way, the username was created from an existing email address.

1

There are 1 best solutions below

1
On BEST ANSWER

I fixed the problem by updating my routes:

resources :users, :id => /[^\/]+/  do