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

Optionally disable injection of nested relations #220

Closed
Patrik-Lundqvist opened this issue Sep 24, 2015 · 2 comments
Closed

Optionally disable injection of nested relations #220

Patrik-Lundqvist opened this issue Sep 24, 2015 · 2 comments
Assignees

Comments

@Patrik-Lundqvist
Copy link

It would be useful to have the ability to disable automatic injection on specific nested relations as it gives a lot of freedom how relations are handled, especially when using custom relation loading with #201.

Something like:

relations: {
  belongsTo: {
    user: {
        localField: 'owner'
        localKey: 'userId',
        inject: false
    }
  }
}
@jmdobry
Copy link
Member

jmdobry commented Oct 4, 2015

I add the inject option to relation definitions, which if set to false should probably also be paired with link: false. You can also set the inject option to a function that will be passed Resource, relationDef, instance, which you can use to manually inject the relation into the store. See https://github.com/js-data/js-data/blob/master/test/both/datastore/sync_methods/inject.test.js#L342 and https://github.com/js-data/js-data/blob/master/test/both/datastore/sync_methods/inject.test.js#L381 and https://github.com/js-data/js-data/blob/master/test/both/datastore/sync_methods/inject.test.js#L437

@Patrik-Lundqvist
Copy link
Author

Nice, works great 👍

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

No branches or pull requests

2 participants