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

issue #118: Allow multiple relationships to same model #122

Merged
merged 1 commit into from
Aug 20, 2014

Conversation

chieffancypants
Copy link
Contributor

Just required another loop

@jmdobry
Copy link
Member

jmdobry commented Aug 19, 2014

Taking another look at it, the new implementation here could be ambiguous, and even allow the same relation to be defined multiple times. Also, I don't really like having arrays of objects with each object only having one key/value pair. I think it should be modified to the following:

belongsTo: {
  user: [
    {
      localField: 'created_by',
      localKey: 'userId'
    },
    {
      localField: 'modified_by',
      localKey: 'userId'
    }
  ]
}

I moved the array one level deeper.

Also, the array check should use DS.utils.isArray to be as cross-browser as possible.

@chieffancypants
Copy link
Contributor Author

Sure, that makes more sense. I force pushed over the previous commit

@jmdobry
Copy link
Member

jmdobry commented Aug 20, 2014

Sweet, I'll be looking at this soon.

jmdobry added a commit that referenced this pull request Aug 20, 2014
issue #118: Allow multiple relationships to same model
@jmdobry jmdobry merged commit 8a66f99 into js-data:master Aug 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants