0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-18 02:21:47 -05:00

Merge pull request #1849 from gimelfarb/fix-1801-pg-404

Fixing 404 on page view when using PostgreSQL
This commit is contained in:
Hannah Wolfe 2014-01-05 13:09:43 -08:00
commit 28f7a7d12d

View file

@ -58,12 +58,24 @@ ghostBookshelf.Model = ghostBookshelf.Model.extend({
return attrs;
},
// Convert bools to ints to be consistent
// across db providers
fixBools: function (attrs) {
_.each(attrs, function (value, key) {
if (typeof value === "boolean") {
attrs[key] = value ? 1 : 0;
}
});
return attrs;
},
format: function (attrs) {
return this.fixDates(attrs);
return this.fixBools(this.fixDates(attrs));
},
toJSON: function (options) {
var attrs = this.fixDates(_.extend({}, this.attributes)),
var attrs = this.fixBools(this.fixDates(_.extend({}, this.attributes))),
relations = this.relations;
if (options && options.shallow) {