<p>Having this route:</p>

<pre><code>map.foo 'foo/*path', :controller =&gt; 'foo', :action =&gt; 'index'
</code></pre>

<p>I have the following results for the <code>link_to</code> call</p>

<pre><code>link_to "Foo", :controller =&gt; 'foo', :path =&gt; 'bar/baz'
# &lt;a href="/foo/bar%2Fbaz"&gt;Foo&lt;/a&gt;
</code></pre>

<p>Calling <code>url_for</code> or <code>foo_url</code> directly, even with <code>:escape =&gt; false</code>, give me the same url:</p>

<pre><code>foo_url(:path =&gt; 'bar/baz', :escape =&gt; false, :only_path =&gt; true)
# /foo/bar%2Fbaz
</code></pre>

<p>I want the resulting url to be: <code>/foo/bar/baz</code></p>

<p>Is there a way around this without patching rails?</p>

Instead of passing path a string, give it an array.
```
```
link_to "Foo", :controller => 'foo', :path => %w(bar baz)
# <a href="/foo/bar/baz">Foo</a>
```
```
If you didn't have the route in your routes file, this same link_to would instead create this:
```
```
# <a href="/foo?path[]=bar&path[]=baz">Foo</a>
```
```
The only place I could find this documented is in
this ticket
.