A little confused about routes


I’m currently playing around with various URL patterns and I’m a little
confused about how routes and the _url helpers work. I’ve read through
the AWDWR book (1st edition and current 2nd edition beta book) and I’m
still not clear on what’s happening.

I’ve been working with variations of the following route:

map.competition ‘competitions/:short_name/:controller/:action’,
:requirements=>{:short_name => /([A-Z0-9][-A-Za-z0-9+

(One side question, is there a good way to avoid having to allow both
‘+’ and ’ ', in the route regexp – it seems that the _url helpers
attempt to match before the string is URL-encoded, while the route
dispatch matches before the is URL-decoded?)

The above route appears to fail on modules:
leads to a recognition failed error.
behave properly. Is there some aspect of modules that only works when
its the first component of a route?

I thought that the _url helpers assume the current controller, however
if I don’t explicitly list a controller I end up with a generated URL
from a call of
competition_url(:action=>‘start’, :short_name=>@competition)
from a view generated by a URL served by the RegisterController.

I don’t really mind having to explicitly add the :controller to my _url
helpers, but I’m wondering why it works some places, but not others.

Thank you,