Forum: Ruby on Rails Routing: Slash in front of controller

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Matt H. (Guest)
on 2007-06-08 08:36
(Received via mailing list)
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?

Kevin S. (Guest)
on 2007-06-08 17:37
(Received via mailing list)
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.
Matt H. (Guest)
on 2007-06-11 13:27
(Received via mailing list)
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.

This topic is locked and can not be replied to.