Approach #3: Use many_to_many
Learn how to implement polymorphism in Ecto using many_to_many associations.
A single notes
table
The final approach to create polymorphic associations is to use many_to_many.
With this approach, we create a single notes
table, then add separate join tables for each of the different associations we want to use with notes.
We would set this up the same way we did before.
Add a migration
First, we added a migration to create a single notes
table.
Get hands-on with 1400+ tech skills courses.