Quantcast
Viewing all articles
Browse latest Browse all 4826

hasMany relationship not workling with inherited model

@felipe wrote:

Hi,
first, explaining the models:

  1. A Parent model that have a “hasMany” relationship
  2. A Child model
  3. The Address model ( the “hasMany”) which has a “belongsTo” Parent.

And, at some point in the application, I receive a Child payload with the addresses, but, for some reason I don’t know (yet), the addresses are not binding to the Child model properly.

It’s something like this:

// person.js
export default DS.Model.extend({
    // . . .
    addresses: DS.hasMany('address', {async: false})
})

// customer.js
export default Person.extend({
    // . . .
})

// address.js
export default DS.Model.extend({
    person: DS.belongsTo('person')
})

The addresses are in the payload, but Customer model does not have the addresses in it.

What I am doing wrong?

Thanks!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4826

Trending Articles