Hi you all,
I have a read-only resource called Tasks in my REST app, with some
attributes, such as subject, initial date, etc. My users will be looking
for listing not only all the tasks, but tasks with certain restrictions
(depending on their attributes), and just by clicking on links (no
forms).
So I have the “/tasks” URL, which lists every task. But I may have a
kind of “/tasks/filter?[att] = [value]” URL, where “[att]” could be the
subject of the task, etc. I have seen this can be done with something
like
“map.resources :tasks :collection{:filter => :get}”
But… how can I get there?
I mean, anywhere I would have the list of filters:
“Filter by subject
Filter by date
…”
And, when clicking on “Filter by subject”, it would show the possible
subjects (in order for the user to click). How this can be modelled? I
thought this can be a resource named “FilteredTasks”.
So, when clicking on “Filter by subject” I can go to a possible page
named “/filtered_tasks/subjects”
And clicking on a specific subject will lead to the
“/tasks/filter?subject=whatever”.
Is this the best REST way to model this kind of searches?
And, if so… how could I select more than one filter criteria at a time?
(filtering tasks by subject AND initial date)
Lots of thanks.
PT: Conversation moved from “REST: nested resources and attributes as resources - Rails - Ruby-Forum”