Comparing
#6 with
#7
Content
[...]
Relations 3 and 4 are essentially the same thing as each other: the linking field `user_id` is not in **this** model, but in the **related** model, and the primary key involved is in **this** model (`User`). The difference is that `HAS_MANY` returns an array of possibly multiple objects, while `HAS_ONE` returns a single object.
`HAS_ONE` is just a special case of `HAS_MANY`, and the circumstances where `HAS_ONE` makes sense are far more limited than `HAS_MANY` and `BELONGS_TO`.
** Weird example
**
~~~
USER table
- id
- name[...]