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

ghost opened this Issue Jul 16, 2013 · 1 comment


None yet

2 participants


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.

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.


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