Topic: Error on username with a period in it

Hello,

I use a unique username login string as my id to lookup users, so I can do something like <url>/users/billy/edit

But I found that if the username has a period in it, the edit_user_path breaks.  What can I do to fix this?  Do I need to add a validation to block usernames with periods?

<td><%= link_to 'Edit', edit_user_path(user) %></td>

Last edited by benjholla (2010-10-28 22:49:46)

Re: Error on username with a period in it

Take a look at the :requirements option for the resources call in your routes file - you can use this to specify a regular expression that includes periods, e.g.

map.resources :users, :requirements => { :id => /.*/ }
Rob Anderton
TheWebFellas

Re: Error on username with a period in it

Thanks! That did the trick.