Best way to create a route that only accepts one format

Hey guys,

I haven’t done this before so I thought I’d ping the mailing list to see
if anyone has any better ideas than what I’ve come up with.

I want to create a route that looks something like this:

Basically, this will route to the “show” method in the controller, and
should only work if the format requested is .png.

I’m using this controller for other things as well, but any other time
it’s accessed through a nested route:

So here’s what I’ve come up with:

map.resources :ads, :only => :show, :as => :counter, :requirements =>
{ :format => :png }
map.resources :users, :has_many => :ads

This seems to be working, however instead of a 404 Not Found being
returned to the browser, it’s returning a 406 Not Acceptable.

Is there any way to generate this route so that unless the format is png
it will return the usual 404 Not Found when a route doesn’t exist?