Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix typo in documentation for polymorphic associations #13405

Merged
merged 3 commits into from
Oct 9, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ Now, to consider a Many-to-Many polymorphic association, instead of considering

The setup for this goes as follows:

* Define the juncion model explicitly, specifying the two foreign keys as `tagId` and `taggableId` (this way it is a junction model for a Many-to-Many relationship between `Tag` and the abstract concept of *taggable*);
* Define the junction model explicitly, specifying the two foreign keys as `tagId` and `taggableId` (this way it is a junction model for a Many-to-Many relationship between `Tag` and the abstract concept of *taggable*);
* Define a string field called `taggableType` in the junction model;
* Define the `belongsToMany` associations between the two models and `Tag`:
* Disabling constraints (i.e. using `{ constraints: false }`), since the same foreign key is referencing multiple tables;
Expand Down Expand Up @@ -424,4 +424,4 @@ WHERE (
We can see that both scopes were applied automatically:

* `` `tag_taggable`.`taggableType` = 'image'`` was added automatically to the `INNER JOIN`;
* `` `tag`.`status` = 'pending'`` was added automatically to an outer where clause.
* `` `tag`.`status` = 'pending'`` was added automatically to an outer where clause.
wbourne0 marked this conversation as resolved.
Show resolved Hide resolved