Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions model/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,10 @@ steal('jquery/class', 'jquery/lang/string', function() {
jqXHR,
promise = deferred.promise();

// destroy does not need data
if ( type == 'destroy' ) {
args.shift();
// pass the old data to delete
if (type !== 'delete') {
//Put the attrs at the end
args.push(args.shift());
}

// update and destroy need the id
Expand Down Expand Up @@ -643,10 +644,12 @@ steal('jquery/class', 'jquery/lang/string', function() {
* that has the id of the new instance and any other attributes the service needs to add.
* @param {Function} error a function to callback if something goes wrong.
*/
return function( id, success, error ) {
var attrs = {};
return function( id, success, error, origAttrs ) {
var attrs = {}, ajaxOb = {};
attrs[this.id] = id;
return ajax( str || this._shortName+"/{"+this.id+"}", attrs, success, error, fixture(this, "Destroy", "-restDestroy"), "delete")
ajaxOb.url = str || this._shortName+"/{"+this.id+"}";
ajaxOb.url = $.String.sub(ajaxOb.url, origAttrs, true);
return ajax(ajaxOb, attrs, success, error, fixture(this, "Destroy", "-restDestroy"), "delete");
}
},

Expand Down
2 changes: 1 addition & 1 deletion view/ejs/ejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ steal('jquery/view', 'jquery/lang/string/rsplit').then(function( $ ) {
out: 'try { with(_VIEW) { with (_CONTEXT) {' + template + " "+finishTxt+"}}}catch(e){e.lineNumber=null;throw e;}"
};
//use eval instead of creating a function, b/c it is easier to debug
myEval.call(out, 'this.fn = (function(_CONTEXT,_VIEW){' + out.out + '});\r\n//@ sourceURL=' + name + ".js");
myEval.call(out, 'this.fn = (function(_CONTEXT,_VIEW){' + out.out + '});\r\n//@ sourceURL="' + name + '.js"');

return out;
};
Expand Down