Forum: Ruby on Rails custom routes, you need string literals correct? when using

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.
koloa (Guest)
on 2007-02-23 16:14
more than 1 route that contains the same number of arguments?
kreiggers (Guest)
on 2007-02-23 21:49
(Received via mailing list)
On Feb 23, 6:14 am, koloa <removed_email_address@domain.invalid> wrote:
> more than 1 route that contains the same number of arguments?

I think you mean if you have two routes like this:

/:arg1/:arg2/:id
/:arg3/:arg4/:id

then yes Rails needs some why to differentiate these like:

/foo/:arg1/:arg2/:id
/bar/:arg3/:arg4/:id

But don't forget that you can also differentiate with regex patterns
if your args are distinguishable by pattern like

/:arg1/:arg2/:id   :requirements => { :arg1 => /\d[A-Z]\d/  }
/:arg3/:arg4/:id   :requirements => { :arg3 => /[a-z]\d[a-z]/ }

The first would match something like '/2D4/anything/12' and the second
would match '/a5d/anything/12' and could be routed different ways.
This topic is locked and can not be replied to.