Skip to content

Instantly share code, notes, and snippets.

@rcy
Created July 2, 2014 17:10
Show Gist options
  • Save rcy/57518aebdf6d920316c0 to your computer and use it in GitHub Desktop.
Save rcy/57518aebdf6d920316c0 to your computer and use it in GitHub Desktop.
simple model wrapper for Meteor collections
Model = {
create: function (collection, methods) {
var model = function (doc) {
_.extend(this, doc);
};
_.extend(model.prototype, methods);
collection._transform = function (doc) {
return new model(doc);
};
return model;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment