The data returned by the REST API I am working with does not have the expected JSON format for Ember.js. The data lacks id values like this:
[{"objectID":"340907","owner":"Lokesh"},{"objectID":"340908","owner":"Cherukuri"}]
To address this issue, I created a custom serializer:
serializers/baddata.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
primaryKey: 'objectID'
});
adapters/baddata.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
host: 'http://localhost:8080',
buildURL : function(modelName, id) {
return this.host + "/baddata/trains/"+ id;
}
});
models/baddata.js
import DS from 'ember-data';
export default DS.Model.extend({
owner: DS.attr('string')
});
However, implementing these changes did not resolve the issue. Can anyone help me identify and correct my mistakes?