Skip to content

Clarification of documentation for hasAndBelongsToMany  #1960

@Overdrivr

Description

@Overdrivr

Documentation for HasAndBelongsToMany relations is a bit confusing, and seems also outdated.

First, documentation starts by

A hasAndBelongsToMany relation creates a direct many-to-many connection with another model, with no intervening model.

Then, the schematic shows three different models, two related together and the last one seems a through model. It seems contradictory with the "no intervening model" statement.

Then, quick typo

For example, here is an excerpt from a model JSON

It may be intended but JSON examples are given for a student model, which is unrelated to the schematic above.

Then, after reading #226, is the following paragraph still valid ?

Adding a relation via REST API
When adding relation through the REST API, a join model must exist before adding relations.
For Example in the above example with "Assembly" and "Part" models, to add an instance of "Part" >to "Assembly" through the REST API interface an "AssemblyPart" model must exist for it to work.

I tried this morning and I was able to add relations without creating a "join" model. I'm not entirely sure but I believe this is deprecated.

Just thought of sharing some feedback.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions