I have an app that was built using the new RESTful methods and I’m trying to access its resources from another app using ActiveResource. (more about the app itself on my blog – http://jystewart.net/process )
The app provides details of bus stops in Grand Rapids, Michigan, and the index method for the stops resource allows users to specify a point (using its longitude and latitude) and a distance, and find all stops within that distance of the point. To do that, I use a query string:
/stops?longitude=X&latitude=Y&distance=Z
That works fine through a browser, but when I try and replicate it using ActiveResource it’s not clear how I’d make the request.
I have my ActiveResource Struct set up as ‘Stop’ and calling
Stop.find(1)
works fine, requesting:
/stops/1.xml
but when I try
Stop.find(:all, :longitude => x, :latitude => Y, :distance => Z)
or
Stop.find(:all, {:longitude => x, :latitude => Y, :distance => Z})
The http request is for:
/stops/longitudeXlatitudeYdistanceZ.xml
I’ve spent some time with the ActiveResource code, and it looks like it won’t support queries like this. Can anyone confirm?
thanks. James.