dimanche 16 avril 2017

findRecord() returns error but record is returned properly

I have a strange error when calling data store's findRecord() function. Below is the function call inside of a route,

return this.get('store').findRecord('restaurant', params.restaurant_id);

And here are the errors I get,

vendor-6605726….js:10 Error while processing route: admin.restaurants.show e.getRecord is not a function TypeError: e.getRecord is not a function

vendor-6605726….js:8 TypeError: e.getRecord is not a function

The strangest thing is that the function works as it should since I can see using ember inspector that the query executes properly and returns the correct record. I have an index route that calls findAll() that does not throw any errors. I am formatting my json correctly I believe so I am out of ideas on what this could me.

Here is the json,

{"data":[{"type":"restaurants","id":1,"attributes":{"user_id":1,"name":"###########","address":"","phone":"##########","website":"##########","created_at":"2017-03-19 20:42:02","updated_at":"2017-03-19 20:42:02","description":"###########"}}]}




Aucun commentaire:

Enregistrer un commentaire