2 Comments

  1. Doug

    1st: I love it, thank you.

    I’m having a small problem with a ‘belongsTo’ relationship if the object which it belongs to is not yet created when the object is created. i.e.

    employee: belongsTo position
    position: hasMany employee

    If an employee is created before the position, the employee.position is forever ‘undefined’ and will not be reactive (or even found by jsData)

    Any Ideas??? Thanks again

    • munderwood

      That’s one that I haven’t encountered myself so far, but my first reaction (so to speak) is that if the relationship is not even found in js-data, then it’s really something to do with that, and not with Vue or its reactivity.

      The only thing I can think of off the top of my head without seeing more code would be if the position is being created only in the front end, and not persisted somewhere that would assign it an id. That is, if you say const bossPosition = store.createRecord({ title: 'CEO' }) then bossPosition.id will be undefined (until after a call to bossPosition.save() resolves), so assigning bossEmployee.position_id = bossPosition.id won’t actually do anything…

Leave a Reply

Your email address will not be published. Required fields are marked *