Well, I wouldn't necessarily say that you should make two separate requests, only that you should maintain a consistent restful api. One issue with trying to merge the two functionalities is that it blurs the meaning of your response message, which now might not be resource-specific, and might not be consistent between your additional parameters. At the very least, a reasonable approach is to maintain a standardized save endpoint, and a separate update & publish endpoint.
In any case, you can add in an ajax request method, or otherwise override save:
- save: function( query ) {
- return can.ajax({
- url: can.sub('foo/{id}.json/?{query}', {
- id: this.id,
- query: can.param(query)
- type: 'PUT',
- data: this.serialize(),
- dataType: 'json'
- });
- })