Polymorphic association foreign key constraints. Is this a good solution?
问题 We're using polymorphic associations in our application. We've run into the classic problem: we encountered an invalid foreign key reference, and we can't create a foreign key constraint, because its a polymorphic association. That said, I've done a lot of research on this. I know the downsides of using polymorphic associations, and the upsides. But I found what seems to be a decent solution: http://blog.metaminded.com/2010/11/25/stable-polymorphic-foreign-key-relations-in-rails-with