ember.js multimodel forms: what is expected from ember-data? -


i have classic multimodel form: transport document has many transport_document_rows, stated in models:

app.transportdocument = ds.model.extend   number: ds.attr 'string'   date: ds.attr 'string'   transportdocumentrows: ds.hasmany('app.transportdocumentrow')  app.transportdocumentrow = ds.model.extend   productname: ds.attr 'string'   quantity: ds.attr 'string'   transportdocument: ds.belongsto('app.transportdocument') 

i write in console script:

a = app.invoice.createrecord(); a.get("invoicerows").pushobject(app.invoicerow.createrecord()); a.get("store").commit(); 

and problem following:

  • my transport document created correctly
  • my transport document row created sequently (and still not problem) wrong transport_document_id (transport_document_id: 0).

is behaviour expected? correct it?

thanks

edit: way works using embedded option:

ds.restadapter.map 'app.transportdocument', {   transportdocumentrows: { embedded: 'always' } } 

this options commits transport document , rows in single http request.

this requires changing response, including transport_document_rows content direcly in transport_documents key of response hash


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -