Skip to content

Conversation

@aars
Copy link
Collaborator

@aars aars commented Mar 7, 2017

ObjectProxys for toOne relationships were initialised with a fresh Ember.Object.create() as their content. Because of this, you can not do this:

if (resource.get('some-to-one-relationship')) { ... } or {{#if resource.some-to-one-relationship}} ... {{/if}}

resource.get('some-to-one-relationship.content') would not work either. You'd have to go look for attributes:resource.get('some-to-one-relationship.id').
But that doesn't work either, since there isn't really an attribute that should always be set... Maybe type, but that's just a hack.

By initialising with something falsy like null, we're all good.

@pixelhandler
Copy link
Owner

@andrewmp1 what do you think about initializing with null ?

@aars
Copy link
Collaborator Author

aars commented Mar 20, 2017

This issue can also be resolved in the toOne-promise-aware PR (and/or the upcoming change on that one, using the proxy).

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

Labels

None yet

2 participants