Skip to content

Commit

Permalink
added json back because of special strategies like hash id
Browse files Browse the repository at this point in the history
  • Loading branch information
nicosommi committed Jul 23, 2015
1 parent 0541261 commit c5e1818
Show file tree
Hide file tree
Showing 5 changed files with 347 additions and 319 deletions.
5 changes: 5 additions & 0 deletions es5/lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,11 @@ var Model = (function () {
}, {
key: "initialize",
value: function initialize() {}
}, {
key: "toJSON",
value: function toJSON() {
return this.attributes;
}
}, {
key: setAttributes,

Expand Down
8 changes: 8 additions & 0 deletions es5/spec/model.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2243,4 +2243,12 @@ describe("Model(attributes, options)", function () {
});
});
});

describe("(exporting)", function () {
describe(".toJSON()", function () {
it("should return a plain unformatted model", function () {
user.toJSON().should.eql(userAttributes);
});
});
});
});
4 changes: 4 additions & 0 deletions es6/lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,10 @@ export default class Model {

initialize() {}

toJSON() {
return this.attributes;
}

/**
* Private Functionality
*/
Expand Down
8 changes: 8 additions & 0 deletions es6/spec/model.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2086,4 +2086,12 @@ describe("Model(attributes, options)", () => {
});
});
});

describe("(exporting)", () => {
describe(".toJSON()", () => {
it("should return a plain unformatted model", () => {
user.toJSON().should.eql(userAttributes);
});
});
});
});
Loading

0 comments on commit c5e1818

Please sign in to comment.