Jose Hales-Garcia
2007-Aug-18 19:18 UTC
What is the best practice for drying up role-based views?
I''m finding a pattern in many of my Rails application''s which is: views that change depending on the role of the person using the application. For example, an admin sees one view and an assistant sees another view. Many elements may be the same but critical elements change. I''m finding drying up the code to display different view elements (links, blocks, etc.) is not easy. I can keep actions from being executed at the controller level, but morphing the views to remove elements not intended for the user is not simple. I''m finding that having separate templates for each role is the safest thing to do, but that isn''t dry at all. I can imagine a series of templates which refine the accessibility of the elements, but that seems like a lot of files and a system is that is not easily maintained. What is the best practice for drying up role-based views? I was reading about aspect oriented programming and how it can be used to layer functionality upon classes. Does this seem like a possible way of layering additional functionality to views? I wonder to what degree Rails and Ruby already are already capable of doing aspect oriented programming of which I''m not aware. Jose ....................................................... Jose Hales-Garcia UCLA Department of Statistics jose-oNoWckAxTcaFhjwBz98joA@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---