Skip to content

Instantly share code, notes, and snippets.

@escoz
Created May 9, 2012 00:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save escoz/2640625 to your computer and use it in GitHub Desktop.
Save escoz/2640625 to your computer and use it in GitHub Desktop.
quickdialog+couchdb
// loads json files directly from couchdb, and syncs to data also in couch.
#import "QRootElement+CouchDocument.h"
#import "App.h"
#import <CouchCocoa/CouchCocoa.h>
@implementation QRootElement (CouchDocument)
- (QRootElement *)initWithCouchDocument:(NSString *)name {
CouchDocument *document = [[[App shared] database] documentWithID:name] ;
self = [[QRootBuilder new] buildSectionsWithObject:document.userProperties];
return self;
}
- (QRootElement *)initWithCouchDocument:(NSString *)name andDataDocument:(NSString *)dataname{
self = [self initWithCouchDocument:name];
if (dataname!=nil){
CouchDocument *datadoc = [[[App shared] database] documentWithID:dataname] ;
[self bindToObject:datadoc.userProperties];
}
return self;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment