Some of my Backbone models should always use POST, instead of POST for create and PUT for update. The server I persist these models to is capable of supporting all other verbs, so using Backbone.emulateHTTP
is not a perfect solution either.
Currently I override the isNew
method for these models and have it return true
, but this is not ideal.
Other than modifying the backbone.js code directly, is there a simple way to achieve this goal on a model-by-model basis? Some of my models can use PUT (they are persisted to a different server that supports all verbs, including PUT), so replacing Backbone.sync with one that converts the 'update' method to 'create' is not ideal either.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…