Forum: Ruby on Rails Routes with parameters ordered differently

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C88bce7e17627b30e124072f2124dacc?d=identicon&s=25 Kailas Narendran (kailas)
on 2009-02-25 15:52
Hi, i'm trying to setup a custom route and having some trouble.

In various resources i've seen plenty of examples of how to do something
along the lines of:

map.connect "foo/bar/:a/:b/:c",
 :controller => "foo",
 :action => "bar",

(and :a,:b and :c get mapped to params[])

what i'd like to do is make a mapping of the form

map.connect ":foo/:controller/:action/:id"

i'd like to do something like this so people can, say, choose a locale
in the url as the param[:foo] (like
http://myserver:3000/en/somecontroller/someaction/)

is that possible?  i tried adding the route:

map.connect ":foo/:controller/:action/:id"

and when i try to go to an address like the one i specified, it returns
that no route matches.

I've seen other posts in the archives that suggest this should work, but
maybe there's something additional that needs to be done?

any help is greatly appreciated.

thanks!

-k
This topic is locked and can not be replied to.