Permalink
Browse files

Adding a missing collection to the sample app.

  • Loading branch information...
1 parent a705829 commit ad0c48ca3d24b1f34fc8a73682da622e635209fd @miccolis miccolis committed Sep 16, 2011
Showing with 23 additions and 0 deletions.
  1. +3 −0 examples/simple/models/Projects.bones
  2. +20 −0 examples/simple/models/Projects.server.bones
@@ -0,0 +1,3 @@
+model = Backbone.Collection.extend({
+ model: models.Project,
+});
@@ -0,0 +1,20 @@
+var fs = require('fs'),
+ path = require('path');
+
+models.Projects.prototype.sync = function(method, model, options) {
+ // Scan the project directory, and send a readme back to the client.
+ var file = path.dirname(require.resolve('bones')) + '/package.json';
+ fs.readFile(file, 'utf8', function(err, data) {
+ if (err) return options.error('Failed to load projects.');
+ data = JSON.parse(data);
+
+ var models = [];
+ _(data.dependencies).each(function(ver, id) {
+ models.push({
+ id: id,
+ version: ver
+ });
+ });
+ options.success(models);
+ });
+};

0 comments on commit ad0c48c

Please sign in to comment.