# Rest-ish method for subsetting an index view?

**URL:** <https://www.ruby-forum.com/t/rest-ish-method-for-subsetting-an-index-view/161623>\
**Category:** Rails\
**Created:** [February 27, 2009, 11:58pm UTC](https://www.ruby-forum.com/t/rest-ish-method-for-subsetting-an-index-view/161623 "2009-02-27T23:58:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rpardee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e47c2d/32.png) [@rpardee](https://www.ruby-forum.com/u/rpardee)\
**Post date:** [February 27, 2009, 11:58pm UTC](https://www.ruby-forum.com/t/rest-ish-method-for-subsetting-an-index-view/161623/1 "2009-02-27T23:58:04Z")

</div>

Hey All,

My app keeps track of /people. A Person has a .typical\_role property,  
which (right now) takes one of the following values: [“Programmer”,  
“Investigator”, “Project Manager”, “Other”].

What’s the best/easiest/neato-cool way to allow users to specify which  
subset of people they want to see on the URL? I’m thinking of urls  
like:

/people/project\_managers  
/people/programmers

etc.

If I wanted to do that, what would I have to do to my routes.rb,  
controller, etc.? Right now all I’ve got is:

map.resources :people

Would it be better/easier to just try to have e.g., a /project\_managers  
index (resource? is that the right terminology?) right at the root of  
the app & not try to hang if off of /people at all?

Many thanks!

-Roy

Roy P.  
Research Analyst/Programmer  
Group Health Center For Health Studies (Cancer Research Network)  
(206) 287-2078  
Google Talk: rpardee

---

<div class="post-metadata">

**Author:** ![rpardee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e47c2d/32.png) [@rpardee](https://www.ruby-forum.com/u/rpardee)\
**Post date:** [February 28, 2009, 7:11pm UTC](https://www.ruby-forum.com/t/rest-ish-method-for-subsetting-an-index-view/161623/2 "2009-02-28T19:11:11Z")

</div>

You could always do something like this:

map.connect ‘/people/:role’, :controller =\> ‘people’, :action =\> ‘index’

Personally, I’d probably go with a url structure like  
/people/filter/programmers:

map.resources :people, :collection =\> { :filter =\> :get }

SH
