Forum: Ruby on Rails rest-ish method for subsetting an index view?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Roy P. (Guest)
on 2009-02-28 00:58
(Received via mailing list)
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



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 P.
Research Analyst/Programmer
Group Health Center For Health Studies (Cancer Research Network)
(206) 287-2078
Google Talk: rpardee
Starr H. (Guest)
on 2009-02-28 20:11
(Received via mailing list)
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

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

This topic is locked and can not be replied to.