0
votes

I had an app with ember-data v.11, perfectly working. updating at ember-data 12 i broke up a relation. As stated here i have these MODELS:

App.TransportDocument = DS.Model.extend
  number: DS.attr 'string'
  transportDocumentRows: DS.hasMany('App.TransportDocumentRow')

App.TransportDocumentRow = DS.Model.extend
  productName: DS.attr 'string'
  quantity: DS.attr 'string'
  measure: DS.attr 'string'
  transport_document: DS.belongsTo('App.TransportDocument')

and i return this JSON:

{
  transport_document:
  {
    number: 1
    transport_document_rows: [602, 601, 3, 2, 1]
  },
  transportDocumentRows: 
  [
    {
      id:602, 
      transport_document_id:1, 
      product_name:dfsds, 
      quantity:1,
      …
    },
    …
  ]
}

My app is seeing the transport document attributes, but ignoring the rows attributes.

I also tried to camelize, tableize, put the rows directly inside the transport document. Nothing seems to work. How do your JSONs look like?

Thank you

1

1 Answers

3
votes

When migrating from one revision to another, check the BREAKING_CHANGES.md file

https://github.com/emberjs/data/blob/master/BREAKING_CHANGES.md

it explains that your json needs to look like this:

{
  transport_document:
  {
    number: 1
    transport_document_row_ids: [602, 601, 3, 2, 1]
  },
  transport_document_rows: 
  [
    {
      id:602, 
      transport_document_id:1, 
      product_name:dfsds, 
      quantity:1,
      …
    },
    …
  ]
}