Politically Incorrect Data Models

While this example may be a good illustration of a one-to-many relationship, it’s also a good way to get punched in the face.

For example if You have Husband and Wife model. Husband has one Wife and Wife belongs to Husband. In that case Wife must contain husband_id column because she belongs to Husband. From other hand Husband don’t have to contain any foreign key, because he is a base model and his Wife knows that she belongs to him.

2 Comments so far

  1. RafaƂ Filipek on September 8th, 2009

    At least in the Arab countries do not threaten me anything because there are only a “has_many” :)

  2. Darryl Waterhouse on October 12th, 2009

    Whilst this may be a good way to get punched in the face, it’s also a good illustration of a one-to-many relationship! ;)

Leave a reply