Extension-less Formats in ActiveResource
March 26th, 2008
When trying to integrate Litmus with Fetch recently we came across an API that whilst appearing RESTful, didn't quite map onto ActiveResource conventions because their URLs 404'd if we included .xml as the extension.
So I quickly whipped up a little plugin to let us specify new formats that don't include extensions.
1 2 3 4 5 6 7 |
class Something < ActiveResource::Base self.site = "http://someone:password@an-app.com" self.prefix = "/api/" self.format = :xml_no_extension end |
Now, calls to
Something.find(:all) |
Perfect!
You can grab the code from the ExtensionlessFormat GitHub repository
2 Responses to “Extension-less Formats in ActiveResource”
Sorry, comments are closed for this article.

Feed me

March 26th, 2008 at 08:48 PM
Thanks for publishing this!
We’ll flesh out the API to be completely RESTful as well as supporting only GET & POST (as it does now for the sake of clients that can’t use all 4 HTML methods).
You rock!
March 27th, 2008 at 05:00 PM
Hey Mike.
No worries! We really like the look of Fetch so we’re looking forward to starting using it and integrating it with Litmus.