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’. My view has this code: <%= link_to 'Export to XML', :overwrite_params => { :format => :xml } %>
This produces the link: http://myserver/programs/arrivals/2.xml. I expect it to produce 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.
Anyone know what's going on here?