ActiveResource in a flurry

Posted by Eric Mill

Apr 26

A look at the Rails Trac’s timeline shows that ActiveResource is undergoing a lot of activity right now, including attention by DHH. Here’s the interesting things I’ve noticed so far:

* Added support for calling custom methods #6979 [rwdaigle] 
     Person.find(:managers)    # => GET /people/managers.xml 
     Kase.find(1).post(:close) # => POST /kases/1/close.xml 

So altogether, ActiveResource is getting a lot more fleshed out. I can’t help but expect we’re going to see its public release soon, and this is awesome.

Another note: I’ll be supporting that last one, about new.xml, in Jester in the next release, because I submitted the patch for it myself. It’ll significantly benefit Jester, and I suspect any other non-Ruby ActiveResource client out there. I’ll try to keep Jester up to date with ActiveResource, but that’s looking like a tall order.


Comments on this post

Alex MacCaw

Apr 29

Alex MacCaw said,

Could you also support the REST spec in the new version, like expecting 204 responses from DELETE requests. Also, you’ve got an extra comma at the end of a hash (can’t remember what line), so it only works in firefox…. Thanks

Eric Mill

Apr 29

Eric Mill said,

Alex – I assume you’re talking about the ActiveResource standards listed in its README, here: README. Or do you mean a more general REST standard?

Two things, though:

Right now, the target audience for Jester is those using Rails-style RESTful controllers. There’s not a lot of common knowledge about these response codes—and the Rails scaffold_resource controller doesn’t use them all. So I’m not going to introduce anything to Jester yet that produces unexpected behavior to people not using these codes. For example, only looking for validation errors if the response code is 422, or assuming an update failed if a 204 wasn’t returned.

The second thing is, that being said, it’d be better if people were following these standards. I’ll submit a patch to Rails to have their scaffold_resource controllers use the codes that their own ARes README says they should be, and I’ll consider enforcing status code responses down the line.

Eric Mill

Apr 30

Eric Mill said,

Oh, and thank you for the comma catch—I check IE compatibility “whenever I remember to”, which is obviously not enough, so I’d missed it. I fixed it just before releasing 1.2 this morning.


Sorry, comments are closed for this article.

© 2000 - 2009 by thoughtbot, inc.
written by a bushel of tiny robots