Subclass' can't have relations that have the same key and reverse relation #381

Open
ghost opened this Issue Jul 16, 2013 · 1 comment

Projects

None yet

2 participants

@ghost

If you create 2 models that are subclasses of a common parent class, relational will give "Cannot create relation... already taken by relation..." errors if each of the models have a relation with the same key and reverse relation. In my example, House and Appartment inherit from building, and both have an "occupants" HasMany relation to Tenant with a "livesIn" reverse relation.

Here's a jsFiddle demonstrating the problem. http://jsfiddle.net/4yv9g/1/

In this simplified example, I realize you could just move the "occupants" relation to the Building class, but in the actual project I'm working on, the "House" and "Appartment" classes use subclasses of Tenant instead.
Thanks!

@sporkd

I'm having the same problem. Only way to make it work is change one of the reverse relation keys to something other than livesIn.

@bpatram bpatram added the bug label Mar 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment