Skip to content

Commit

Permalink
fixes #13 - allow an id column with a value of 0.
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierlacot committed Jun 21, 2012
1 parent 6ea1cf2 commit 62c1498
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions joli.js
Expand Up @@ -722,14 +722,14 @@ var joliCreator = function() {

joli.record.prototype = {
destroy: function() {
if (!this.id) {
if (typeof this.id === 'undefined') {
throw ("Unsaved record cannot be destroyed");
} else {
this._options.table.deleteRecords(this.id);
}
},
fromArray: function(data) {
if (data.id) {
if (typeof data.id !== 'undefined') {
this._originalData = {
id: data.id
};
Expand Down Expand Up @@ -763,7 +763,7 @@ var joliCreator = function() {
return false;
}

return !(this.id && joli.toQueryString(this._data) === joli.toQueryString(this._originalData));
return !((typeof this.id !== 'undefined') && joli.toQueryString(this._data) === joli.toQueryString(this._originalData));
},
save: function() {
var data = {
Expand Down

0 comments on commit 62c1498

Please sign in to comment.