Just out of curiosity, do you have any examples of multiple extensions where those other than the root extension aren’t a compression or archive format? I ask in the context of this being considered a bad practice. To me, naming something anImage.jpg.zip.tar.gz means I started with a JPEG, and then stuck that inside a zip, then put the zip in a tar, then the tar in a gzip. Those “extra” extensions are all container formats, so it makes sense to show that there’s a file of a different format nested inside them. If things become more arbitrary, say anImage.jpg.txt, which just returns the JPEG’s binary data as text/plain, that doesn’t really hold up for me. That seems presentational, not a text file containing a jpeg.
If the only time that multiple extensions ever come into play is archive/compression, middleware still seems like a good option. The URL helpers could remain fairly consistent (eg, resource_path(@resource, :format => [:xml, :zip]) and the additional functionality be transparent. Rails really doesn’t need to know it’s happening as long as it’s generating correct URLs. If zipping is far and away the most likely case for this (which I think is likely), resource_path(@resource, :zipped => :xml) may even make sense.
Basically, for all the examples I’ve thought of, anytime multiple extensions are being used appropriately, the root extension is the only one that it makes sense to Rails to actually handle. But if there are examples to indicate otherwise I’d be interested to hear them.
The only things I’ve gotten close on is like:
/runs/1 => web view of a GPS recorded running route
/runs/1.json => JSON version
/runs/1.xml => XML version
/runs/1.xml.gpx => XML that adheres to GPX standard
/runs/1.xml.tcx => XML that adheres to TCX standard
But those last two, to me, are simply improperly name.