Damaris Fuentes
2007-Nov-19 14:27 UTC
REST: Listing resources filtered by their attributes
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 "http://www.ruby-forum.com/topic/131724" -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---