I tried to make a simple emberapp with rails, that shows some users info from our system.
My route: /api/users returns this json:
{"users":[{"id":1,"username":"Evolutio","email":"mail@evolutio.tld"}]}
My emberadapter:
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
host: 'https://api.domain.tld',
namespace: 'api',
headers: {
//"API_KEY": "secret key",
}
});
my users/model.js
import DS from 'ember-data';
export default DS.Model.extend({
username: DS.attr('string'),
email: DS.attr('string')
});
my users/index/route.js
import Ember from 'ember';
export default Ember.Route.extend({
model() {
let users = this.store.findAll("users");
return users;
}
});
I visit this url: localhost:4200/users
When I delete the user/model.js I get this error:
WARNING: Encountered "users" in payload, but no model was found for model name "user" (resolved model name using frontend@serializer:application:.modelNameFromPayloadKey("users"))
and the data with the ember inspector:
Aucun commentaire:
Enregistrer un commentaire