samedi 11 juillet 2015

Ember REST Adapter, change record before save

Main question:

Is there something like a willSave or beforeSave or beforeCreateRecordor didCreate method for Ember Data RESTAdapter?

Background:

I have a have some data which requires me to make an extra API call, and use the results of that call, before every createRecord.

The problem is, if I try to override createRecord, the DS.Snapshot therein doesn't allow me to change its properties before it gets saved.

Ideally I'd like to make this call before createRecord but I am open to after createRecord as well.

It also needs to be adapter method as far as I can tell, not a model hook, because there is a native object I need access to which I don't want to save on the server. (i.e. DS.Model's didCreate returns the already-stored data from the server)




Aucun commentaire:

Enregistrer un commentaire