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

Closed
tinganho opened this Issue Apr 29, 2014 · 3 comments

Comments

Projects
None yet
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

This comment has been minimized.

Show comment
Hide comment
@PaulUithol

PaulUithol May 21, 2014

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?

Owner

PaulUithol commented May 21, 2014

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

This comment has been minimized.

Show comment
Hide comment
@tinganho

tinganho May 21, 2014

@PaulUithol I will come back with a fiddle later

@PaulUithol I will come back with a fiddle later

@tinganho

This comment has been minimized.

Show comment
Hide comment
@tinganho

tinganho Aug 1, 2014

This is no longer a problem.

tinganho commented Aug 1, 2014

This is no longer a problem.

@tinganho tinganho closed this Aug 1, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment