Hi all, I was wondering if it is possible to dynamically chain class methods in rails. Suppose there are several optional methods that a class may have, I want to chain call all the methods that apply to a certain class. Is it possible? What is the best approach to do achieve this?
Thanks in advance. -- Anderson Mesquita www.aposasopa.com Linux User #419944 2009/8/12 doug <[email protected]> > > Let's say that one has a set of controller actions that he plans to > deploy on a collection of different web sites. For the most part, any > particular action on any given web site in the collection is the same > as the corresponding action on any other web site in the collection. > However, there can be minor customizing tweaks to various actions on a > site by site basis. So, across web sites, corresponding controller > actions are similar but not identical. > > It would be nice to have the base (common) code for the actions in a > superclass of the controller. That way the base code could be kept > pristine and identical across all web sites. The minor customizing > tweaks could be implemented as overriding code in the controller. > That makes the tweaks much more prominent. In addition, the big > advantage is that if the base code is updated and the updates don't > affect the tweaks, updates to the base code are simply drop-in > replacements which don't require any customization. > > The base code could be put in the application controller; but, then it > would inherit down to all controllers. A separate class for each > controller inserted between the application controller and the > particular controller involved is what seems to be needed. My > question is: Is that the way to do it; or, is there a better way? > I'm concerned about breaking the class chain setup by Rails. Maybe > it's no big deal; but, I'd like to know that for sure. > > Thanks for any input. > > ... doug > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

