DestroyRecord with EmbeddedRecordMixin


#1

Hi guys

Is there something preventing a destroyRecord from performing a DELETE?

I have a model which has multiple belongsTo and hasMany of records that are reusable. My serializer is setup like this:

App.ProductSerializer = DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
    attrs: {
        productProperty: { embedded: "always" },
        categories: { embedded: "always" },
        productVariants: { embedded: "always" },
        defaultVariant: { embedded: "always" },
        productOptionTypes: { embedded: "always" },
        standardVariantProperty: { embedded: "always" }
    }
});

Whenever I’m trying to call a destroyRecord() on a product, ember-data is performing a PUT rather than a DELETE. When trying to use deleteRecord() (and not saving the model) only thing happening is the “isDirty” flag being changed to true.

Is there something I have to do in order for a regular destroyRecord() to work? Thanks. :smile:

Edit: I have realised (only seconds after posting this topic) that I can get around this by setting “isDeleted” to TRUE and the saving the model. But why can’t I use a regular destroyRecord() or even deleteRecord()?

product.set("isDeleted", true);
product.save();