lundi 22 octobre 2018

Ember js belongs to relationship

I have two models employee and empdetails

//employee model
import DS from 'ember-data';
export default DS.Model.extend({
    empId : DS.attr(),
    password : DS.attr(),
    email : DS.attr(),
    empdetails : DS.belongsTo("empdetails") 
});

//empdetails model
import DS from 'ember-data';    
export default DS.Model.extend({
    firstName : DS.attr(),
    lastName : DS.attr(),
    dateOfJoining: DS.attr(),
    employee : DS.belongsTo("employee")
});

I use RESTAdapter to make REST calls.

//serializer
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
});

When I try to make a get request for employee I get the below error

Please check your serializer and make sure it is serializing the relationship payload into a JSON API format. Error: Assertion Failed: Encountered a relationship identifier without a type for the belongsTo relationship

Can someone guide me in rectifying the error




Aucun commentaire:

Enregistrer un commentaire