views:

21

answers:

1

I have a rails route that goes to the

#works for "/profile/abc"
/profile/:id

However, it breaks when the url's id is capitalized

#breaks for "/profile/Abc"
/profile/:id

Anyone knows why?

+2  A: 

You can specify constraints for id explicitly (if Rails says 'no such route'), like

map.connect '/profile/:id', ..., :constraints => { :id => /.+/ }

On constraints

Then, in your view, you can convert params[:id] to lower case. Also, if id has upper-case letters, you can redirect user to a proper (lower-case) url.

Although, reading the question again, I don't exactly understand what "breaks" means.

Nikita Rybak