Responding to a non-registered MIME type?

I'm trying to figure out how attachments are supposed to work with MIME type-based responses. What makes attachments special is that in many cases they are allowed to be arbitrary files. It would be too restrictive to require that all possible types are registered (Mime::Type.register).

Let's say for GET requests on an attachment resource I want to return metadata if the requested format is XML or JSON. Otherwise I want to return the attachment itself.

  class AttachmentsController < ApplicationController     respond_to :xml, :json     respond_to :all, :only => :show

    def show       @attachment = ...       respond_with(@attachment) do         format.any { send_file @attachment.path }       end     end   end

This doesn't work, because #any really means any, including :xml and :json. This doesn't work as intended, either

      respond_with(@attachment) do         format.xml         format.json         format.any { send_file @attachment.path }       end

It has to be

      respond_with(@attachment) do         format.xml {}         format.json {}         format.any { send_file @attachment.path }       end

But that is not the kind of code I'd like to write. I'd rather write

      respond_with(@attachment) do         format.default { send_file @attachment.path }       end

With the intended meaning that the default block is only used if respond_to :all is active for the action and there is no more specific explicit or implicit response for the format.

Did I miss how to do this with the existing responder code? Are there serious reasons why it should not be done anyway?