Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 7 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 8 additions and 2 deletions.
  1. +1 −1  package.json
  2. +7 −1 servers/Route.bones
View
2  package.json
@@ -1,7 +1,7 @@
{
"name": "bones",
"description": "Framework for using backbone.js on the client and server.",
- "version": "2.3.0",
+ "version": "2.3.2",
"author": {
"name": "Development Seed",
View
8 servers/Route.bones
@@ -110,6 +110,9 @@ server.prototype.loadCollection = function(req, res, next) {
server.prototype.loadModel = function(req, res, next) {
var name = req.params.model;
if (name in this.models) {
+ // `id` in param wins over `id` in request body.
+ if (req.body && 'id' in req.body && req.params.id)
+ req.body.id = req.params.id;
// Pass any querystring paramaters to the model.
req.model = new this.models[name]({ id: req.params.id }, req.query);
}
@@ -144,9 +147,12 @@ server.prototype.saveModel = function(req, res, next) {
server.prototype.delModel = function(req, res, next) {
if (!req.model) return next();
+ if (req.body && !req.model.set(req.body, {
+ error: function(model, err) { next(err); }
+ })) return;
req.model.destroy({
success: function(model, resp) {
- res.send({}, headers);
+ res.send(resp, headers);
},
error: function(model, err) {
var error = err instanceof Object ? err.message : err;

No commit comments for this range

Something went wrong with that request. Please try again.