DEV Community

roeihaviv
roeihaviv

Posted on

Associations

This rule helps me whenever I create direct and indirect associations:

For every forign key there should be a "belongs_to", and for every "belongs_to" there should be "has_many".

By following this rule it is much easier to keep track on all the associations, and quickly identify if something is missing.

Top comments (0)