Rest-ish method for subsetting an index view?


#1

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


#2

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