Remove updateAttribute as remote method
This commit is contained in:
parent
49da6f4249
commit
fbf0e35f1d
|
@ -17,9 +17,35 @@ Model.shared = true;
|
|||
* For **remoting**. Construct objects when calling instance methods remotely.
|
||||
*/
|
||||
|
||||
Model.sharedCtor = function (data, id, fn) {
|
||||
// after remote hook
|
||||
Model.afterRemote = function (name, fn) {
|
||||
var self = this;
|
||||
if(this.app) {
|
||||
var remotes = this.app.remotes();
|
||||
remotes.after(self.pluralModelName + '.' + name, function (ctx, next) {
|
||||
fn(ctx, ctx.result, next);
|
||||
});
|
||||
} else {
|
||||
var args = arguments;
|
||||
this.once('attached', function () {
|
||||
self.afterRemote.apply(self, args);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* Called when a model is extended.
|
||||
*/
|
||||
|
||||
Model.setup = function () {
|
||||
var ModelCtor = this;
|
||||
|
||||
// each model has its
|
||||
// own access control
|
||||
// list
|
||||
Model.acl = [];
|
||||
|
||||
Model.sharedCtor = function (data, id, fn) {
|
||||
if(typeof data === 'function') {
|
||||
fn = data;
|
||||
data = null;
|
||||
|
@ -57,10 +83,10 @@ Model.sharedCtor = function (data, id, fn) {
|
|||
} else {
|
||||
fn(new Error('must specify an id or data'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// before remote hook
|
||||
Model.beforeRemote = function (name, fn) {
|
||||
// before remote hook
|
||||
ModelCtor.beforeRemote = function (name, fn) {
|
||||
var self = this;
|
||||
if(this.app) {
|
||||
var remotes = this.app.remotes();
|
||||
|
@ -73,35 +99,7 @@ Model.beforeRemote = function (name, fn) {
|
|||
self.beforeRemote.apply(self, args);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// after remote hook
|
||||
Model.afterRemote = function (name, fn) {
|
||||
var self = this;
|
||||
if(this.app) {
|
||||
var remotes = this.app.remotes();
|
||||
remotes.after(self.pluralModelName + '.' + name, function (ctx, next) {
|
||||
fn(ctx, ctx.result, next);
|
||||
});
|
||||
} else {
|
||||
var args = arguments;
|
||||
this.once('attached', function () {
|
||||
self.afterRemote.apply(self, args);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* Called when a model is extended.
|
||||
*/
|
||||
|
||||
Model.setup = function () {
|
||||
var ModelCtor = this;
|
||||
|
||||
// each model has its
|
||||
// own access control
|
||||
// list
|
||||
Model.acl = [];
|
||||
|
||||
ModelCtor.sharedCtor.accepts = [
|
||||
{arg: 'data', type: 'object', http: {source: 'body'}},
|
||||
|
|
|
@ -61,7 +61,6 @@ describe('DataSource', function() {
|
|||
existsAndShared('isNewRecord', false);
|
||||
existsAndShared('_adapter', false);
|
||||
existsAndShared('destroy', true);
|
||||
existsAndShared('updateAttribute', true);
|
||||
existsAndShared('updateAttributes', true);
|
||||
existsAndShared('reload', true);
|
||||
|
||||
|
|
Loading…
Reference in New Issue