Browse files

Use toJSON instead of toObj in responder strategies

  • Loading branch information...
1 parent 1c51f31 commit 31db24cd659d1244c517a936de4a28e940d41046 @mde mde committed Jan 25, 2014
Showing with 4 additions and 4 deletions.
  1. +2 −2 lib/controller/responder/strategies/api.js
  2. +2 −2 lib/controller/responder/strategies/html.js
View
4 lib/controller/responder/strategies/api.js
@@ -33,7 +33,7 @@ var utils = require('utilities')
// Determine if `content` is a model object
if (content instanceof model.ModelBase) {
// Respond in the style {attr: val, attr2: val...}
- response = content.toObj();
+ response = content.toJSON();
response.id = content.id;
response.type = content.type;
response.errors = content.errors;
@@ -49,7 +49,7 @@ var utils = require('utilities')
// Determine if `content` is a collection of models
else if (content instanceof Array) {
response = content.map(function (item) {
- return item.toObj();
+ return item.toJSON();
});
}
else if (content instanceof Error || (content.message && content.stack)) {
View
4 lib/controller/responder/strategies/html.js
@@ -116,7 +116,7 @@ var utils = require('utilities')
// Respond in the style
// {model: {attr: val, attr2: val...}, params: {}}
response = {params: params};
- response[type] = content.toObj();
+ response[type] = content.toJSON();
response[type].id = content.id;
this.respond.call(this, response, options);
@@ -145,7 +145,7 @@ var utils = require('utilities')
response[type] = [];
content.forEach(function (item) {
- response[type].push(item.toObj());
+ response[type].push(item.toJSON());
});
this.respond(response, options);

0 comments on commit 31db24c

Please sign in to comment.