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

Not able to override serializePolymorphicType for Embedded records #3871

Closed
maheshiv opened this issue Oct 19, 2015 · 1 comment
Closed

Not able to override serializePolymorphicType for Embedded records #3871

maheshiv opened this issue Oct 19, 2015 · 1 comment

Comments

@maheshiv
Copy link

Here is my models,

APP.User = DS.Model.extend({
  name: DS.attr('string'),
  itemLock: DS.belongsTo('item-lock')
});
APP.ItemLock = DS.Model.extend({
  item: DS.belongsTo('item', {polymorphic: true}),
  UserId: DS.belongsTo('user')
});

Here is the serializers,

APP.UserSerializer = DS.RESTSerializer.extend({
  attrs: {
    itemLock: {embedded: 'always'}
  }
});
APP.ItemLockSerializer = DS.RESTSerializer.extend({
  serializePolymorphicType: function(snapshot, json, relationship) {
    console.log('snapshot:-', snapshot);
  }
});

Here is sample response

{
 user: {
  id: 1,
  name: 'John',
  itemLock: {
   id: 1,
   item: 2,
   itemType: 'assignment'
  }
 }
}

I am using Ember-data V1.13.8. I am not able to override serializePolymorphicType. Any thoughts on this?

@pangratz
Copy link
Member

pangratz commented Jan 2, 2016

I think this issue can be closed since #3875 and #3876 have been merged...

@bmac bmac closed this as completed Jan 2, 2016
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

3 participants