Marcelo de Moraes Serpa
2007-Nov-24 00:42 UTC
Listing documents in two different controllers - refactor?
Hello, if I have a document model (not RESTful) that belongs_to document_category and a document controller with a list action, and I want to list document per category can I just pass the id of the category as the :id GET param of the list action and filter the documents for this category? I think that that this wouldn''t be semantically good since one would expect to get a list of all documents in the list action. The correct way I think would be to get the filtered documents by category in the document_categories/show/2. Also, document_categories/list would show a list of document categories and not documents, right? The point here is that I think that this is not dry since I have two actions in two different controllers that lits documents - one all and the other filtered. Of course I could have some kind of shared partial for each document entry but the code in the controllers would still be similar. This smells refactoring somehow... Any suggestions on best practices regarding this? Thanks in advance! Marcelo. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Apparently Analagous Threads
- Issues with mod_proxy/mod_proxy_balancer and my ded. server host
- [RFC PATCH net-next v6 4/4] netvsc: refactor notifier/event handling code to use the bypass framework
- Authenticating against ActiveDirectory - can't read userPassword/unicodePwd?
- Why use DatabaseCleaner with rSpec?
- config.action_controller.session[:secret] vs protect_from_forgery :secret