Fix scopeMethods closure issue
This commit is contained in:
parent
dd9ea68f47
commit
3b398c5f77
|
@ -64,12 +64,15 @@ function extendScopeMethods(definition, scopeMethods, ext) {
|
|||
if (typeof ext === 'function') {
|
||||
customMethods = ext.call(definition, scopeMethods, relationClass);
|
||||
} else if (typeof ext === 'object') {
|
||||
function createFunc(definition, relationMethod) {
|
||||
return function() {
|
||||
var relation = new relationClass(definition, this);
|
||||
return relationMethod.apply(relation, arguments);
|
||||
};
|
||||
};
|
||||
for (var key in ext) {
|
||||
var relationMethod = ext[key];
|
||||
var method = scopeMethods[key] = function () {
|
||||
var relation = new relationClass(definition, this);
|
||||
return relationMethod.apply(relation, arguments);
|
||||
};
|
||||
var method = scopeMethods[key] = createFunc(definition, relationMethod);
|
||||
if (relationMethod.shared) {
|
||||
sharedMethod(definition, key, method, relationMethod);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue