Backbone-relational
Backbone-relational copied to clipboard
Cannot create relation=s ... already taken by relation=s
Hi,
I am very much stuck creating relations between my models. I am reusing some models as submodels and it always gives me the error:
Cannot create relation=s on "page_id" for model=s: already taken by relation=s.
take for example a base class Animal
. There are different type of animals and this is achieved using the submodelType mapping. clean! great!
Now some animals have tails, others don't, but for those animals who do have tails, it is always the same thing: a tail. Here is where it goes wrong. If I a define relation to the tail model from 2 different animals, I get the above error.
Animal = backbone.relationalModel.extend({});
Tail = backbone.relationalModel.extend({});
Dog = Animal.extend({
relations:[Tail]
});
Cat = Animal.extend({
relations:[Tail]
});
Spider = Animal.extend({
relations:[]
});
In this example, Spider is not a problem. But Cat and Dog are fighting for the reverseRelation key and giving me that error. How can I solve this?? I believe it is the same issue as #72, but i don't see a solution there either.
thx Stefan
I also have run into this. see https://github.com/PaulUithol/Backbone-relational/issues/503