I have app that will need to be able to display records matching a search criteria. What is the RESTful way to do this? Just an plain index action with search parameters? Should the query parameters be built into the route?
Additionally, the records themselves will have multiple views associated with them, ie: html & graphs, but all via a webpage. Would responds_to be the proper way to approach this?
I have app that will need to be able to display records matching a search
criteria. What is the RESTful way to do this? Just an plain index action
with search parameters? Should the query parameters be built into the route?
That's how I would do it. Ideally you'll have a Search object so that
it makes writing search rules more modular and results aren't session-
based (and you can share them across users). Definitely include the
parameters in the URL if for no other reason because you'll strengthen
your google juice.
Additionally, the records themselves will have multiple views associated
with them, ie: html & graphs, but all via a webpage. Would responds_to be
the proper way to approach this?
If you can, also check out the Rails Recipes book. One of the recipes
is how to write a search controller and actions that are modular and
can be shared across multiple other controllers.