I just started to learn how to use more advanced models in Rails. The one I use regularly, with great success, is a model in which a cross-to-many-to-many cross-reference relationship is implemented by a class that itself is a subclass of the base class in a many-to-many relationship.
Thus, the cross-reference class can act as a stand-in for the base class.
A good example is that the node (NavigationNode) navigation hierarchy cross-references the user role. At the cross-reference point, the class (RoleNavigationNode) can inherit from NavigationNode and still have in-depth knowledge of the user's role.
My question (in the above case) can RoleNavigationNode inherit from NavigationNode and nevertheless refer to the cross-reference table, and not to the one accessed by NavigationNode - this, of course, is using ActiveRecord.
I have not investigated polymorphic association, which may be more appropriate.
Thanks in advance,
Larry m
source
share