Configuring relationships
Before we study the methods in detail, we need to understand that all relations can specify the parameters that configure the relation. Each relation follows the following pattern:
name
: This is the mandatory name of the relation and is a symbol by which the relation will be referenced.options
: This is a hash that is used to configure the relation.block
: This is an optional block of code to configure some relations.
Common options for all relations
The following options are common to all relations:
:class_name
: This is the class name if it cannot be determined from the name.:inverse_of
: This is the reverse relation, it is very important for creating or embedding relations.:extend
: If we need to configure the relation by passing a block, a module is created on the fly with this block and the relation class then extends from this module.:inverse_class_name
: This is used to determine the foreign key.:name
: This is the name of the relation.:relation
: This is the type of...