TrevTheDev
TrevTheDev

Reputation: 2737

How to unload embedded records in Ember

How does one unload an embedded record in Ember Data?

This jsbin illustrates that:

this.store.unloadRecord(record);

works on the parent record but not on the embedded child record (documented here).

Is there another way to remove the embedded child record from the store without sending a delete request to the server?

Upvotes: 1

Views: 292

Answers (1)

GJK
GJK

Reputation: 37369

There isn't a way to do that (at least no documented way to do it). The reason is that embedded records are not really records. It's convenient terminology, but it's not true. Embedded records are really more like attributes than records in the sense that they are attached to their parent record. They can't stand on their own because they have no identity on their own, and they can be detached from their parent because then the parent is incomplete.

I'm not sure what your use case is, but if you no longer need the data, my advice would be to just not use it.

Upvotes: 1

Related Questions