vendor/components/indefinido-indemma/build/release.js in ende-0.4.7 vs vendor/components/indefinido-indemma/build/release.js in ende-0.4.8
- old
+ new
@@ -19982,11 +19982,11 @@
after_mix: [],
record: {
after_initialize: [],
before_initialize: []
},
- all: function() {
+ every: function() {
return this.cache;
},
create: function() {
var params;
@@ -20605,11 +20605,11 @@
if (!key) {
throw new TypeError("InvalidFind: resource.find was called with a falsey value");
}
return this.storage.store(key);
},
- all: function() {
+ every: function() {
return this.storage.values();
},
where: function() {
throw new Error('queryable.where: Not implemented yet');
}
@@ -20828,11 +20828,11 @@
record.dirty = true;
savings.push(record.save(callback));
}
return $.when.apply($, savings);
},
- all: function(conditions, doned, failed) {
+ every: function(conditions, doned, failed) {
if (conditions == null) {
conditions = {};
}
if (typeof conditions === 'function') {
doned = conditions;
@@ -20851,11 +20851,11 @@
conditions = {};
}
namespaced = conditions[this.resource] || {};
namespaced.limit = 1;
namespaced.order = 'desc';
- return this.all(conditions, callback);
+ return this.every(conditions, callback);
},
get: function(action, data) {
var default_route, old_route, payload, promise, resource;
if (data == null) {
@@ -21115,11 +21115,11 @@
}
return JSON.stringify(serialized);
}
},
json: function(methods) {
- var definition, json, name, nested, value;
+ var definition, json, name, nature, nested, value;
if (methods == null) {
methods = {};
}
json = {};
@@ -21134,25 +21134,32 @@
}
value = this[name];
if (value == null) {
continue;
}
- if (type(value) === 'function') {
+ nature = type(value);
+ if (nature === 'function') {
continue;
}
- if (type(value) === 'object') {
+ if (nature === 'object' || nature === 'element') {
if (nested) {
+ if (!value.json) {
+ console.warn("json: Tryied to serialize nested attribute '" + name + "' without serialization method!");
+ continue;
+ }
json["" + name + "_attributes"] = value.json(methods[name]);
} else if ((value.toJSON != null) || (value.json != null)) {
if (value.resource) {
continue;
}
if (value.json != null) {
json[name] = value.json(methods[name]);
} else {
json[name] = value.toJSON(methods[name]);
}
+ } else {
+ continue;
}
} else {
json[name] = value;
}
}
@@ -21483,10 +21490,10 @@
return modelable.record.after_initialize.push(function() {
return scopable.model.forward_scopes_to_associations.call(this);
});
});
model.associable.mix(function(singular_association, plural_association) {
- plural_association.all = plural_association.reload = function(data, done, fail) {
+ plural_association.every = plural_association.reload = function(data, done, fail) {
var promises, reload;
if (this.parent != null) {
this.route || (this.route = "" + this.parent.route + "/" + this.parent._id + "/" + (model.pluralize(this.resource)));
}