Skip to content

Instantly share code, notes, and snippets.

@lxbarth
Created January 24, 2012 22:46
Show Gist options
  • Save lxbarth/1673210 to your computer and use it in GitHub Desktop.
Save lxbarth/1673210 to your computer and use it in GitHub Desktop.
var couch = require('backbone-couch');
var register = models.Company.register;
models.Company.register = function(server) {
var config = server.plugin.config;
var options = {
host: config.couchHost,
port: config.couchPort,
name: config.couchPrefix + '_companies'
};
// Give the model access to the CouchDB object.
var db = couch(options);
// maybe: this.prototype.couchDb = db.db;
this.prototype.sync = db.sync;
return register.apply(this, arguments);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment