Support resource and discovery URLs with or without .json extension

This commit is contained in:
zeke
2012-01-24 16:27:40 -08:00
parent 2d25217dd2
commit 54209dd341
4 changed files with 61 additions and 36 deletions

View File

@@ -233,12 +233,15 @@
// adeed by ayush
createAll: function(values){
// debugger;
values = this.fromJSON(values);
// debugger;
for (var i=0, il = values.length; i < il; i++) {
var record = values[i];
record.newRecord = false;
record.id = record.id || Spine.guid();
record.id = record.id || Spine.guid();
this.records[record.id] = record;
}
@@ -282,7 +285,7 @@
},
last: function(){
var values = this.recordsValues()
var values = this.recordsValues();
var record = values[values.length - 1];
return(record && record.clone());
},
@@ -331,7 +334,7 @@
fromJSON: function(objects){
if ( !objects ) return;
if ( typeof objects == "string" )
objects = JSON.parse(objects)
objects = JSON.parse(objects);
if ( isArray(objects) ) {
var results = [];
for (var i=0; i < objects.length; i++)