# A RESTful way for filtering results?

**URL:** <https://www.ruby-forum.com/t/a-restful-way-for-filtering-results/107740>\
**Category:** Rails\
**Created:** [June 25, 2007, 9:50pm UTC](https://www.ruby-forum.com/t/a-restful-way-for-filtering-results/107740 "2007-06-25T21:50:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Rumble](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c0e974/32.png) [@Mike\_Rumble](https://www.ruby-forum.com/u/Mike_Rumble)\
**Post date:** [June 25, 2007, 9:50pm UTC](https://www.ruby-forum.com/t/a-restful-way-for-filtering-results/107740/1 "2007-06-25T21:50:37Z")

</div>

Hello,

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, /  
articles/index?user\_id=1&section\_id=1.

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?
