# Does overwrite\_params ignore routing priority?

**URL:** <https://www.ruby-forum.com/t/does-overwrite-params-ignore-routing-priority/130603>\
**Category:** Rails\
**Created:** [February 29, 2008, 6:47pm UTC](https://www.ruby-forum.com/t/does-overwrite-params-ignore-routing-priority/130603 "2008-02-29T18:47:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Ravn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ccd318/32.png) [@James\_Ravn](https://www.ruby-forum.com/u/James_Ravn)\
**Post date:** [February 29, 2008, 6:47pm UTC](https://www.ruby-forum.com/t/does-overwrite-params-ignore-routing-priority/130603/1 "2008-02-29T18:47:33Z")

</div>

My routes.rb looks like this:  
map.resources :programs, :member =\> { :arrivals =\> :get }  
map.connect ‘:controller/:action/:id’  
map.connect ‘:controller/:action/:id.:format’

Running ‘rake routes’ (omitting some of the routes for brevity):  
arrivals\_program GET /programs/:id/  
arrivals  
{:controller=\>“programs”, :action=\>“arrivals”}  
formatted\_arrivals\_program GET /programs/:id/  
arrivals.:format  
{:controller=\>“programs”, :action=\>“arrivals”}  
/:controller/:action/:id  
/:controller/:action/:id.:format

Now let’s say I’m at this url: ‘[http://myserver/programs/2/arrivals](http://myserver/programs/2/arrivals)’.  
My view has this code:  
\<%= link\_to ‘Export to XML’, :overwrite\_params =\> { :format =\> :xml }  
%\>

This produces the link: [http://myserver/programs/arrivals/2.xml](http://myserver/programs/arrivals/2.xml). I  
expect it to produce [http://myserver/programs/2/arrivals.xml](http://myserver/programs/2/arrivals.xml).

For some reason it picks the lowest priority route,  
the /:controller/:action/:id.:format route at the bottom of routes.rb.

When I delete /:controller/:action/:id.:format from routes.rb, it  
correctly spits out [http://myserver/programs/2/arrivals.xml](http://myserver/programs/2/arrivals.xml).

Anyone know what’s going on here?
