javascript - Models are not serialized with Ember.js and WebApiAdapter -


I'm trying to use it with my model, but I'm not getting it to work.

For now, the server side code is working, the result of the browser is correct. But amber-data, or custom webapp - serializer, is not able to create data.

I have two models: Patient:

  App.Patient = DS Model.extend (); App.Patient.reopen ({patientId: DS.attr ( 'number'), first name: DS.attr ( 'string'), Last Name: DS.attr ( 'string'), aufenthalte: DS.hasMany ( 'aufenthalt '), //, {async: true} fullName: function () {return.get (' firstname ') +' '+ this.get (' lastname ');} .property (' firstname ',' lastname ') ,}); App.PatientSerializer = DS.WebAPISerializer.extend ({primaryKey: 'patientId', // ember-data-1.0.0-beta2 does not handle embedded data as if they were in a time 00:13, so present to us in the present / / release in the future once applied embedded, we'll go back to Vebapiaisaiailaijr. // details https://github.com/emberjs/data/blob/master/TRANSITION.md Nikalenare Description: function (Store, primary type, payload) {var primary type name = primary type, type; var Karnam = primary type name, type = store.modelFor (typeName); var data = {}; data [typeName] = payload; Detakawfenthlet = []; var Samanyikritarere = Pelodkmap (function (hash) {hash. Ufentheltkmap (function (aufenthalt) {data.aufenthalte.push (aufenthalt);}); hash .aufenthalte = hash.aufenthalte.mapProperty ( 'aufenthaltId'); return hash;}, this); payload = information; it back Come on. Super.apply (this, logic);}, generalize: {patient: function (hash) {hash.patientId = hash.id; return hash;}}});  

Aufenthalt:

  App.Aufenthalt = DS.Model.extend ({aufenthaltId: DS.attr ('number'), name: DS.attr ('String'), Patient ID: DS.T.T.R.R ('number'), Patient: D.S.Belong ('Patient'),}); App.AufenthaltSerializer = DS.WebAPISerializer.extend ({primaryKey: 'aufenthaltId', commonly hash: {aufenthalte: function (hash) {hash .aufenthaltId = hash.id; return hash;},}});  

When I get a list of "patients" from my controller, then the datamodels are filled correctly (I can see it in the Chrome Amber Plugin) , I get an error: "error while loading the route: type error: can not set the clutter" property "

thanks!

Do you have the right router in the app / router folder, app / controller The controller in the folder, and this same scene and templates are added? Feel free to grind a link for your sample solution so that I can download and view.

=== Update 2 / 22/2014 === I decided to code, you should be able to download modified solutions from you, to see the changes you should have a windif on two directories. I would like to change some places for my scenario It is necessary, which includes:

  1. Patient. Js, extend it directly from the recyclers, and add Extract SING implementation.
  2. Change the template of Patsucheautocomplete.hbs
  3. Added patient \ index.hbs.
  4. Modified controller \ htmlhelperextensions.cs, to make it work properly:
  5. paitentview.js (may not be required because it is all default)
  6. < Li> Sub folder template in debug mode.

Comments