Routing: Slash in front of controller


OK, A while back (pre 1.2, if I remember correctly), putting a slash
in front of a controller name then using link_to would cause any
recalled parameters to be ignored, e.g. On a page with a url of /
articles/edit/1?test=1, the following code would produce a link to /

link_to “Edit”, :controller=>"/articles", :action=>“edit”

This appears to be broken after 1.2, and the following bug report has
been closed with “invalid”:

Does anyone know if this is the new intended functionality, and if so,
is there another way of producing the depreciated effect?



Maybe url_for’s :overwrite_params option will be what you are looking
for. link_to will accept the same options and parameters.

Kevin S.


Thanks for the reply, Kevin - unfortunately, it’s not what I need, and
the docs do seem to verify that the bug is valid (thanks for the
link). To quote the docs:

There are a few simple rules on how this is performed:

* If the controller name begins with a slash, no defaults are

used: url_for :controller => ‘/home’
* If the controller changes, the action will default to index
unless provided

It seems that the bug report needs to be reopened. Ah well.