Parameters with dots on the URI
Posted
by robertokl
on Stack Overflow
See other posts from Stack Overflow
or by robertokl
Published on 2010-04-08T13:31:46Z
Indexed on
2010/04/08
13:33 UTC
Read the original article
Hit count: 297
ruby-on-rails
|routing
In my application, there is a resource, machine, and a nested resource from machine: ip.
I want to be able to access the URI of an Ip typing the ip address.
The URI should be something like this:
/machines/m123/ips/192.168.0.1.xml
Where "m123" is the name of the machine and "192.168.0.1" is one of the ips of that machine.
The problem here is that rails miss understand the dots from the ip and the format. When I try to access this page, i get:
No route matches "/machines/m123/ips/192.168.0.1.xml"
And if I replace the dots for any other character it works, witch means that rails isn't handling the dots on the URI.
Is there any way to enter a more complex regexp on the routes to make sure rails can treat it the way I want?
I'm using rails 2.3.5 and ruby 1.8.7.
Thank you.
© Stack Overflow or respective owner