Painless Polymorphic Associations

When working in Rails, polymorphic association offers a way to have a model belong to multiple models through an association — this is accomplished by allowing you to choose what model you select a foreign key from. If you’re wondering ‘how does that work?’ and ‘what would that look like?’, well, you came to the right place!

Preface