src/modules/o_O.model.js in eyeballs-0.5.15 vs src/modules/o_O.model.js in eyeballs-0.5.16
- old
+ new
@@ -28,30 +28,30 @@
{
initial_class_methods.push(method);
}
}
- var run_callback = function(callback, method, object, response){
+ var run_callback = function(callback, method, object, response, xhr){
try{
if(typeof callback === 'function' && method === 'success')
{
callback(object, response);
}
if(typeof callback === 'object' && typeof callback[method] === 'function')
{
- callback[method](object, response);
+ callback[method](object, response, xhr);
}
}
catch(e)
{
if(typeof console === 'object')
{
console.log(e);
}
else
{
- alert(e);
+ alert(e.name + "\n" + e.message);
}
}
}
var config = callback.apply(class_methods, [class_methods]);
@@ -174,11 +174,11 @@
}
if(!attributes['id'])
{
attributes['id'] = o_O.uuid();
}
- if(!attributes['new_record'])
+ if(attributes['new_record'] !== false)
{
attributes['new_record'] = true;
}
return attributes;
},
@@ -188,22 +188,22 @@
find: function(id, callback){
if(this.adapter)
{
run_callback(callback, 'loading', this.initialize({id: id}))
var model = this;
- return this.adapter.find(this, id, function(returned_object, response){
+ return this.adapter.find(this, id, function(returned_object, response, xhr){
found_object = model.initialize(returned_object);
if(!found_object['new_record'])
{
found_object['new_record'] = false;
}
if(found_object.id)
{
- run_callback(callback, 'success', found_object, response);
+ run_callback(callback, 'success', found_object, response, xhr);
}
else
{
- run_callback(callback, 'failure', found_object, response);
+ run_callback(callback, 'failure', found_object, response, xhr);
}
}, callback);
}
},
model_name: model_name,
\ No newline at end of file