Ruby on Rails: allow parameters to have "." (dot)

Vote Up Down

11

Vote down!
Body
By default, dot in rails router is used to separate the format from the rest of the url. To allow dot in a parameter, override the constraint. The below example allows any character except slash:

get "/:user/contributions" => 'users#contributions', :constraints => { :user => /[^\/]+/ }