Wednesday, 15 February 2012

json - Embjerjs store.find not working while getJSON is -


I am starting to build an amber app, I'm almost done with the API, which works for me. I am able to display correctly with .getJSON, but not with store.find method, instead I get an unknown type of error, which I am guessing the amount of data that is not recovering properly. I am using Amber Inspector in Chrome, but I do not know why he is trying to get JSON, I am assuming that it should be "API / Projects".

Thank you!

  window App = amber application. Create (); App.Router.map (function () {this.route ('project')}); App.ApplicationAdapter = DS.RESTAdapter.extend ({Namespace: 'API'}); App.Projects = DS.Model.extend ({title: DS.attr ('string'), Description: DS.attr ('string')});  

This works:

  App.ProjectsRoute = Ember.Route.extend ({Model: function () {Refund $ .getJSON ("API / Projects "). Then (function (data) {return data.projects;});}});  

It is not:

  App.ProjectsRoute = Ember.Route.extend ({model: function ()} return.store.find (' Projects');}}); Error while processing route: Project can not read property type 'type' of undefined type: Undefined property on DS can not read 'type'. RESTAdapter.DS.Adapter.extend.findAll (http://trgmanage.app/js/libs/ember-data.min.js:928455) at Object.Ember.assert (http://trgmanage.app/js / Libs / ember-1.10.0.debug.js: 3934: 27) but the DS.Ember.Object.eddedFaceLal (http://trgmanage.app/js/libs/ember-data.min.js: 8: 20000) at DS.store.member.object.and.find all (http://trgmanage.app/js/libs/ember-data.min.js:8:19773) in DS.store.emember.object . Expand (http://trgmanage.app/js/libs/ember-data.min.js:8:16174) at App.ProjectsRoute.Ember.Route.extend.model (http://trgmanage.app/js/ App.js: 13: 23) at EmberObject.extend.deserialize (http://trgmanage.app/js/libs/ember-1.10.0.debug.js:23915:21) at applyHook (http: // trgmanage. App / js / libs / ember-1.10.0.debug.js: 50118: 30) on object. Handler InfoRent Shared Model Hook (http://trgmanage.app/js/libs/ember-1.10.0.debug.js: 48139: 22) at Object.subclass.getModel (http://trgmanage.app/js /libs/ember-1.10.0.debug.js:48365:21)  

JSON Response: (Formatted JSONview in Chrome)

  {projects : [{Id: 1, title: "This is going on", Description: "The above has been revealed, even the number of all the leaders, and they can be taken to the place later. It is necessary to do this in the form of a group of companies. , But did not say anything to them. "}, {Id: 2, title:" twinkle1 ", Description:" Encounter and it actually invades during life. "Culpa voluptatum accusamus voluptate voluptate or nihil. Let's talk about you and tell only about those people non-qui snatite rim acuid end. "}, {Id: 3, title:" Culpa quibusdam perspiciatis id dolorem consequences. ", Description: "This is not really an easy way for this feature. Optios charge what you can do JSON Response Asimated:  
  {"Project": [{"id": 1, "Google" heading ":" go this Has been "," description ":" has reached the place after this ", even the number of all the leaders, and can be taken to the place later, as a group of all companies. Required for. The disciplines were interrupted, but nothing has been said to them. "}, {" Id ": 2," Sheer ":" Twinkle1 "," description ":" encounter and it actually invades during life. "Culpa voluptatum accusamus voluptate voluptate or nihil. Suit Adyphe deli Nihil Choir Dolorum Tell you about it and only about those people "Information": "It is not true that it is not really." "Description:" "," "": 3, "title": "Culpa quibusdam perspiciatis id dolorem result.", "Description" There is an easy way for this feature. Opti Charges Such as what you can do is using an old one. The Open was using an old one. Version of Ember-data Beta 6 Yakas After updating to the latest Beta 15, all this works just as much as you want. 


No comments:

Post a Comment