Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create relation=s ... already taken by relation=s #490

Open
netdust opened this issue Sep 17, 2014 · 1 comment
Open

Cannot create relation=s ... already taken by relation=s #490

netdust opened this issue Sep 17, 2014 · 1 comment
Labels

Comments

@netdust
Copy link

netdust commented Sep 17, 2014

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

@netdust netdust changed the title extending relations in RelatedModel Different models using instance of same submodel Sep 17, 2014
@netdust netdust changed the title Different models using instance of same submodel Cannot create relation=s ... already taken by relation=s Sep 19, 2014
@tjwebb
Copy link

tjwebb commented Nov 18, 2014

I also have run into this. see #503

@bpatram bpatram added the bug label Mar 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants