Skip to content
This repository
  • 14 commits
  • 3 files changed
  • 0 comments
  • 2 contributors
2  package.json
... ... @@ -1,7 +1,7 @@
1 1 {
2 2 "name": "bones",
3 3 "description": "Framework for using backbone.js on the client and server.",
4   - "version": "2.3.0",
  4 + "version": "2.4.0",
5 5
6 6 "author": {
7 7 "name": "Development Seed",
3  server/collection.js
@@ -10,7 +10,8 @@ Backbone.Collection.toString = function() {
10 10 Backbone.Collection.register = function(app) {
11 11 // Add the collection if it's not a server-only collection.
12 12 this.files.forEach(function(filename) {
13   - if (!(/\.server\.bones$/).test(filename) && app.assets) {
  13 + if (!(/\.server\.bones(\.js|)$/).test(filename) && app.assets &&
  14 + app.assets.models.indexOf(filename) < 0) {
14 15 app.assets.models.push(filename);
15 16 }
16 17 });
8 servers/Route.bones.js
@@ -110,6 +110,9 @@ server.prototype.loadCollection = function(req, res, next) {
110 110 server.prototype.loadModel = function(req, res, next) {
111 111 var name = req.params.model;
112 112 if (name in this.models) {
  113 + // `id` in param wins over `id` in request body.
  114 + if (req.body && 'id' in req.body && req.params.id)
  115 + req.body.id = req.params.id;
113 116 // Pass any querystring paramaters to the model.
114 117 req.model = new this.models[name]({ id: req.params.id }, req.query);
115 118 }
@@ -144,9 +147,12 @@ server.prototype.saveModel = function(req, res, next) {
144 147
145 148 server.prototype.delModel = function(req, res, next) {
146 149 if (!req.model) return next();
  150 + if (req.body && !req.model.set(req.body, {
  151 + error: function(model, err) { next(err); }
  152 + })) return;
147 153 req.model.destroy({
148 154 success: function(model, resp) {
149   - res.send({}, headers);
  155 + res.send(resp, headers);
150 156 },
151 157 error: function(model, err) {
152 158 var error = err instanceof Object ? err.message : err;

No commit comments for this range

Something went wrong with that request. Please try again.