Skip to content

Commit

Permalink
Make Server.couchdb user type = "Client" and not type = "App.Client"
Browse files Browse the repository at this point in the history
This makes it easier to share objects across sproutcore client apps
  • Loading branch information
Geoffrey Donaldson authored and Erich Ocean committed Sep 24, 2008
1 parent db7eef1 commit f8f6b72
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions server/couchdb_server.js
Expand Up @@ -100,14 +100,16 @@ SC.CouchdbServer = SC.Server.extend({
listFor: function(opts) {
var recordType = opts.recordType ;
var resource = recordType.resourceURL() ; if (!resource) return false ;

var recordName = recordType.toString()
// TODO: check if the user has given a path to a view.
// if so, call that view (with Method: GET)
var url = resource + "/_temp_view"
var content = {}

recordName = recordName.split('.').last() ;

var context = {
recordType: recordType
recordType: recordName
}

// TODO: CouchDB will have to deal with these a little different i think
Expand All @@ -121,7 +123,7 @@ SC.CouchdbServer = SC.Server.extend({

// Here is the couchdb temp view code.
content.map = "function(doc) { " +
"if (doc.type == \'"+ recordType +"\' ){ "+
"if (doc.type == \'"+ recordName +"\' ){ "+
"emit(doc._id, doc)"+
"}}" ;
// TODO: check if the user has given a path to a view.
Expand Down Expand Up @@ -191,7 +193,7 @@ SC.CouchdbServer = SC.Server.extend({
if (!curRecords.hasOwnProperty(rec)) continue ;
if (curRecords[rec].get('attributes')){
atts = curRecords[rec].get('attributes');
atts.type = curRecords[rec]._type._objectClassName ;
atts.type = curRecords[rec]._type._objectClassName.split('.').last() ;
//atts._id = curRecords[rec]._guid ; // we don't want to send an id to start with
delete atts.guid ;
delete atts.idDirty ; // Not sure what this is or where it comes from
Expand Down

0 comments on commit f8f6b72

Please sign in to comment.