Skip to content

Commit

Permalink
fix(docs): fix typo in documentation for polymorphic associations
Browse files Browse the repository at this point in the history
change juncion -> junction
  • Loading branch information
anujjoshi63 committed Aug 5, 2021
1 parent 56bb1d6 commit 73bf585
Showing 1 changed file with 2 additions and 2 deletions.
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.

0 comments on commit 73bf585

Please sign in to comment.