A RESTful way for filtering results?


Recently I’ve been getting stuck in with ActiveResource and all the
wonderful things that REST has to offer.

There are a couple of things that I’ve been throwing around in my head
which I can’t quite settle on so I was hoping that some of the more
experienced Rails programmers on here might be able to help me.

I have an articles controller on to which I wish to add some filtering
for the index action. Traditionally you’d have something like /
articles/index?user_id=1, but I’m struggling to work out the best
approach to making this REST friendly. It’s straight forward enough to
do it the other way around using nested resources for user, ending up
with something like users/1/articles, but I’m looking to do it the
other way around so I’d end up with something like articles/user/1 but
this doesn’t map well on to ActiveResource and isn’t very scalable,
for example I would like to be able to add compound filters, ie, /

Am I best of just sticking to the good old query string and breaking
out of the REST paradigm in this instance? Anybody have any experience
of creating an app which uses a RESTful approach to filtering like

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs