I''ve found a reply to my question.
My issue is a known problem of named routes which appears to be fixed
in trunk version.
See the link below for reference
http://www.ruby-forum.com/topic/74049
Paolo
2006/8/8, Paolo Negri <hungrylist@gmail.com>:> Hi all
>
> In my application I''ve some named routes defined this way...
>
> map.label_context1 '':context1/label'', :controller =>
''mycontroller''
>
> map.label_context2 '':context1/:context2/label'',
:controller => ''mycontroller''
>
> map.label_context3 '':context1/:context2/:context3/label'',
:controller
> => ''mycontroller''
>
> The controller for the 3 routes is the same but obviously it behaves
> differently whether 1 or 2 or 3 contexts are given.
>
> The routes and the controller just work fine BUT...
>
> Now, on the same page of my application, I want to generate links for
> all the possible levels my controller can act...
>
> I.e. if I''m in context3 I want to provide links to context1,
context2
> and context3 urls
>
> So I''ve done something like
>
> label_context1_url params
> label_context2_url params
> label_context3_url params
>
> This code just returns n times the most complete url.
>
> i.e. if I''m in context3 the code above will generate 3 identical
urls
>
> :context1/:context2/:context3/label
>
> Can someone explain to me this beahviour?
>
> my opinion is that if the *_url method is overfed with parameters that
> exceed the parameters of the named route, the method will fallback on
> a standard route generation returning the most complete url.
>
> How can I force the *_url method to generate the url from the given named
route?
> Or, how can I ask a named route which parameters is able to take, so I
> can dynamycally delete the parameters in surplus?
>
> Thanks
>
> Paolo
>