Cannot access model with belongsTo relation

Ember version: 3.10.2

After I changed the relation to belongsTo I get a proxy object. I have tried many different syntaxes to access it without success.

I originally had a model firstName: DS.attr(“string”), lastName: DS.attr(“string”), group: DS.attr()

then I changed group to group: DS.belongsTo("group-names")

in model/group-names I have name: DS.attr("string")

The reason that I made the change was that I’m trying to track the dirtyAttribute of the model with nested properties. This question was seen to come up a few times over the years.

You’re getting a proxy because relationships are async by default. If you know you’ll have the data loaded already (and therefore don’t need async relationships) you can change it to:

group: DS.belongsTo("group-names", { async: false})

In templates referencing will work fine either way but if it’s in JS that you want the group name your JS will become async once you add the async relationship. So you either have to handle the data as async now or convert the relationship to sync. Hope that makes sense!