Foreign key constraints on polymorphic relationships

I am setting up foreign key constraints in my database and wasn’t sure
if it was possible to set them up on polymorphic relationships. Any help
is greatly appreciated. Thanks.

Hi Ben,

I am setting up foreign key constraints in my database and wasn’t sure
if it was possible to set them up on polymorphic relationships. Any help
is greatly appreciated. Thanks.

This isn’t possible by default. A rather complex workaround is to use
stored procedures that fire on insert and update triggers, but I’d
advise against it because it’s far from the Rails idiom.


Roderick van Domburg