overriding rest show route but not delete

hi, lets say routes.rb has

     map.resources :foo

and I want the show action to have a diffent url, so I add (after the above line)

     map.foo '/bar/:id', :controller => 'foo', :action => 'show'

this works fine, including foo_path( :id => "1") => /bar/1 and <%= link_to 'Show', foo %>

But now this also seems to go to the show action, not destroy

  <%= link_to 'Destroy', foo, :confirm => 'Are you sure?', :method => :delete %>

Your named route map.foo goes explicitly to the show action. It's overriding the path method created by the map.resources.

ok, so how can i make it override the show action but not the delete one, which has a similar path with different request method?

If your example is an accurate representation of your application's behavior, then you're overriding the restful route method foo_url with the named map.foo, which will also generate a foo_url method. Give map.foo a different name, and the methods won't conflict any more.