- Extended by:
- Included in:
- Defined in:
provides mapping of type to model name
Defined Under Namespace
Constant Summary collapse
- WRAPPED_CLASSES =
WRAPPED_CLASSES maps relationship types to Relationship models.
Typically, it's a 1:1 relationship, with a type having a model of the same name. Sometimes, someone needs to be a precious snowflake and have a model name that doesn't match the rel type, so this comes in handy.
As an example, Chris often finds it easier to name models after the classes that use the relationship: `StudentLesson` instead of `EnrolledIn`, because it's easier to remember “A student has a relationship to lesson” than “the type of relationship between Student and Lesson is 'EnrolledIn'.” After all, that is a big part of why we have models, right? To make our lives easier?
A model is added to WRAPPED_CLASSES when it is initalized AND when the `type` class method is called within a model. This means that it's possible a model will be added twice: once with the type version of the model name, again with the custom type. deal_with_it.gif.