jinzhu/gorm — pull request #303 by jnfeinstein (2014-11-26 17:27:49+00:00)
Title: Support polymorphic has-one and has-many associations

These commits allow gorm to handle has-one and has-many relationships using a POLYMORPHIC setting. The child struct should have the appropriate fields. For example, `POLYMORPHIC:Owner` means the child should have `OwnerId` and `OwnerType`, which are automagically filled in by gorm upon creation.

I left out belongs-to and many-to-many because go's typesystem doesn't allow you to get a type from a string. You can do some hacks like registering all types into a map, but that seems hacky. I added explicit errors to notify users when these associations are encountered at runtime.