Polymorphism in Other Frameworks
Learn how polymorphism works in other frameworks.
We'll cover the following...
Some frameworks, notably ActiveRecord and Laravel, have a built-in convention to support polymorphic relationships. Here’s how we might follow that convention with our notes feature.
Make arrangements
Say that our notes
table started with just the following two columns.
Field | Type |
notes | text |
author | string |
To support polymorphism, we would add two more columns that would indicate the table name and ID of the record we want to attach the note to. When naming these ...