# Routing: Slash in front of controller

**URL:** <https://www.ruby-forum.com/t/routing-slash-in-front-of-controller/106297>\
**Category:** Rails\
**Created:** [June 8, 2007, 6:36am UTC](https://www.ruby-forum.com/t/routing-slash-in-front-of-controller/106297 "2007-06-08T06:36:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bouldr-matt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/85e7bf/32.png) [@bouldr-matt](https://www.ruby-forum.com/u/bouldr-matt)\
**Post date:** [June 8, 2007, 6:36am UTC](https://www.ruby-forum.com/t/routing-slash-in-front-of-controller/106297/1 "2007-06-08T06:36:22Z")

</div>

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 /  
articles/edit/1:

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”:

[http://dev.rubyonrails.org/ticket/7792](http://dev.rubyonrails.org/ticket/7792)

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

Thanks!

---

<div class="post-metadata">

**Author:** ![bouldr-matt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/85e7bf/32.png) [@bouldr-matt](https://www.ruby-forum.com/u/bouldr-matt)\
**Post date:** [June 8, 2007, 3:37pm UTC](https://www.ruby-forum.com/t/routing-slash-in-front-of-controller/106297/2 "2007-06-08T15:37:31Z")

</div>

Maybe url\_for’s :overwrite\_params option will be what you are looking  
for. link\_to will accept the same options and parameters.

> **[ActionController::Base](https://api.rubyonrails.org/classes/ActionController/Base.html#M000262)**
>
> Action Controllers are the core of a web request in Rails. They are made up of one or more actions that are executed on request and then either it renders a template or redirects to another action.

HTH,  
Kevin S.  
[http://www.nullislove.com](http://www.nullislove.com)

---

<div class="post-metadata">

**Author:** ![bouldr-matt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/85e7bf/32.png) [@bouldr-matt](https://www.ruby-forum.com/u/bouldr-matt)\
**Post date:** [June 11, 2007, 11:27am UTC](https://www.ruby-forum.com/t/routing-slash-in-front-of-controller/106297/3 "2007-06-11T11:27:23Z")

</div>

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.

Matt
