How to turn flag "isNew" to false?

Hi there,

I am looking for something a little bit tricky. Today, I am working with a model which live in session (server side) and I need to create it client side when the session is empty.
But, following the REST/CRUD philosophy I need to PUT on it to update it.

So, as newest created record, Ember Data make a post and the models root ; in conclusion, I need to turn the “IsNew” flag of the record to false to perform a PUT instead of a POST.

Any idea on the way to do that ?

Sorry for my bad english ; feel free to ask any question in case of miscomprehension.

I think you’re trying to work around an issue by setting a lifecycle property which in turn will use the verb you’re after. Instead, I would recommend implementing your own adapter which extends from DS.RestAdapter and reimplement methodForRequest.

https://github.com/emberjs/data/blob/v2.7.0/addon/adapters/rest.js#L1271-L1281

Tutorial on implementing a custom adapter: Customizing Adapters - Models - Ember Guides

It seem pretty good. Thank you !