Rails: routes and special characters like dots

Rails doesn’t seem to like dots and other special chars in its routes.
If you want to use URLs like http://www.domain.com/post/1/just_a_test.. logically the following route seems to be sensible:

map.connect '/post/:id/:title', :controller => 'forum', :action => 'show_post'

But rails won’t like the dots. Use a route like the following to allow a URL with special characters to be routed:

map.connect '/post/:id/:title', :controller => 'forum', :action => 'show_post', :requirements => { :title => /.*/ }

Keywords: dots, dot, no route matches, punkt, punkte, routes.rb, routing, route, rails, problem, won’t work

2 Responses to “Rails: routes and special characters like dots”

  1. Hi, I have got the same problem. Did you find a solution ?!
    Thanks.

  2. you’re funny ;) this post contains the solution

Leave a Reply


linkboost