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

Vote Up Down

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

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 => /[^\/]+/ }