2 Matching Annotations
- Feb 2022
The existence of polymorphic associations does not allow the database to enforce referential integrity, however, because no foreign keys can be defined.
Good point. In my example, cardinalities would be fundamentally different: an Entry could have_many :messages and have_many :comments. In the original example, a Message could have_many :entries, etc. In either case, there's no way to enforce the cardinalities at the database level (not that I'm aware of).