Add custom key support for hasMnay relationships

Turns out using a custom embedded key for polymorphic hasMany relationships wasn't working. Fixed this, and added a test.