Skip to content

Loading…

Can not set relations if the relations contain type `HasMany` and `HasOne` #458

Closed
tinganho opened this Issue · 3 comments

2 participants

@tinganho

I'm trying to set following relation:

relations : [{
      type: 'HasMany',
      key: 'conditions',
      relatedModel: Condition,
      collectionType: Conditions,
      reverseRelation: {
        key: 'translation',
        includeInJSON: 'id'
      }
    },
    {
      type: 'HasOne',
      key: 'else',
      relatedModel: Else,
      reverseRelation: {
        key: 'translation', // Change this value to something other than translation works
        includeInJSON: 'id'
      }
    },
    {
      type: 'HasMany',
      key: 'inputs',
      relatedModel: Input,
      collectionType: Inputs,
      reverseRelation: {
        key: 'translation',
        includeInJSON: 'id'
      }
    }],

I got this error
screen shot 2014-04-29 at 9 37 01 pm
Though changing it the reverse relation key to something other than translation works.

@PaulUithol
Owner

On itself (when adding empty models for Condition, Else, Input), this code runs fine. So there's more going on here that you've left out. Could you try to create a jsFiddle showing the problem in runnable code?

@tinganho

@PaulUithol I will come back with a fiddle later

@tinganho

This is no longer a problem.

@tinganho tinganho closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.