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

serializePolymorphicType with async property #2484

Closed
lumenlunae opened this issue Nov 17, 2014 · 2 comments
Closed

serializePolymorphicType with async property #2484

lumenlunae opened this issue Nov 17, 2014 · 2 comments

Comments

@lumenlunae
Copy link

Seems like with an async property, my belongsTo relationship that returns a DS.PromiseObject fails to properly serialize.

This line fails:

json[key + "Type"] = Ember.String.camelize(belongsTo.constructor.typeKey);

because belongsTo.constructor returns DS.PromiseObject

So far, this fix looks to work:

if (belongsTo.constructor === DS.PromiseObject) {
json[key + "Type"] = Ember.String.camelize(belongsTo.content.constructor.typeKey);
} else {
json[key + "Type"] = Ember.String.camelize(belongsTo.constructor.typeKey);
}

Just seeing if it's actually a bug or I might be missing something fundamental. Thanks!

@luketheobscure
Copy link
Contributor

Dupes this issue I think: #2385

@lumenlunae
Copy link
Author

Oh! Thanks, and the solution looks much better executed. Thank you!

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

No branches or pull requests

2 participants