Of all the suggestions thus far I think the one that makes the most sense is a Rack middleware (or even further out on Apache/Nginx/etc). That watches for the request to expect compressed results and does the compression removing the extension on the way in and re-applying it on the way out. Not involving Rails at all.
Note that there is a module for nginx that (may) solve this already: http://wiki.nginx.org/NgxZip (I haven't used it at all, it probably doesn't do any form of url re-writing to handle the .zip extension as necessitated to make this Rails transparent) On Monday, 6 August 2012 07:02:49 UTC-4, Alexey wrote: > > On Sunday, August 5, 2012 4:51:37 PM UTC+2, Matt Huggins wrote: >> >> If the goal of this post is to change the functionality of `:format` to >> return "xml.zip", then I disagree. "xml.zip" is not a file extension, >> which I believe the `:format` param is intended to represent. Looking at >> the list of file >> formats<http://en.wikipedia.org/wiki/List_of_file_formats_(alphabetical)>, >> it is not on the list -- only "zip" is because it is still a zip file >> despite the "xml" preceding it. >> >> This is the same as saying that "tar.gz" is a file extension -- it's not. >> The "tar" before the "gz" indicates that this gzipped file probably >> contains a tar file, but the extension is still "gz". That's probably why >> the "tgz" file format was introduced. >> >> Just my 2 cents. >> > > Matt, i was only proposing to parse the URL slightly differently, probably > without impact for existing applications. I am already using both "csv" > and "csv.zip" formats in my application (mostly for testing and > experimenting), i only do not like that i have to access "csv.zip" like > this: "/users.csv_zip". > > - Alexey. > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/fQXCFVzbOFYJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
