diff --git a/model/model.js b/model/model.js index 9e0e589d..140902d6 100644 --- a/model/model.js +++ b/model/model.js @@ -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 @@ -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"); } }, diff --git a/view/ejs/ejs.js b/view/ejs/ejs.js index 5805f71d..e5132159 100644 --- a/view/ejs/ejs.js +++ b/view/ejs/ejs.js @@ -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; };