diff --git a/config.js b/config.js
index 2efb35f99f..4d78613143 100644
--- a/config.js
+++ b/config.js
@@ -86,7 +86,7 @@ config.env = {
connection: {
filename: path.join(__dirname, '/core/shared/data/ghost-dev.db')
},
- debug: true
+ debug: false
},
url: {
host: '127.0.0.1',
diff --git a/core/admin/assets/tpl/list-item.hbs b/core/admin/assets/tpl/list-item.hbs
index 8b78a33607..1d1dcd37a0 100644
--- a/core/admin/assets/tpl/list-item.hbs
+++ b/core/admin/assets/tpl/list-item.hbs
@@ -2,10 +2,11 @@
{{title}}
{{!1,934}}
diff --git a/core/shared/data/fixtures/001.js b/core/shared/data/fixtures/001.js
index effac94613..91e9fc9c2d 100644
--- a/core/shared/data/fixtures/001.js
+++ b/core/shared/data/fixtures/001.js
@@ -17,9 +17,11 @@ module.exports = {
"status": "published",
"featured": true,
"author_id": 1,
- "created_at": '2012-11-09T15:40:46.776Z',
+ "created_at": '1352475600601',
"created_by": 1,
- "published_at": '2012-11-09T15:40:46.776Z',
+ "updated_at": '1352475600601',
+ "updated_by": 1,
+ "published_at": '1352475600601',
"published_by": 1
},
{
@@ -36,9 +38,11 @@ module.exports = {
"status": "published",
"featured": true,
"author_id": 1,
- "created_at": '2012-06-25T01:00:23.776Z',
+ "created_at": '1340582400102',
"created_by": 1,
- "published_at": '2012-06-25T01:00:23.776Z',
+ "updated_at": '1340582400102',
+ "updated_by": 1,
+ "published_at": '1340582400102',
"published_by": 1
}
],
diff --git a/core/shared/models/base.js b/core/shared/models/base.js
index 9fc8f843cf..3a0fb51086 100644
--- a/core/shared/models/base.js
+++ b/core/shared/models/base.js
@@ -1,5 +1,6 @@
var GhostBookshelf,
Bookshelf = require('bookshelf'),
+ _ = require('underscore'),
config = require('../../../config');
// Initializes Bookshelf as its own instance, so we can modify the Models and not mess up
@@ -11,6 +12,35 @@ GhostBookshelf = Bookshelf.Initialize('ghost', config.env[process.env.NODE_ENV |
GhostBookshelf.Model = GhostBookshelf.Model.extend({
// Base prototype properties will go here
+ // Fix problems with dates
+ fixDates: function (attrs) {
+ _.each(attrs, function (value, key) {
+ if (key.substr(-3) === '_at' && value !== null) {
+ attrs[key] = new Date(attrs[key]);
+ }
+ });
+
+ return attrs;
+ },
+
+ format: function (attrs) {
+ return this.fixDates(attrs);
+ },
+
+ toJSON: function (options) {
+ var attrs = this.fixDates(_.extend({}, this.attributes)),
+ relations = this.relations;
+
+ if (options && options.shallow) {
+ return attrs;
+ }
+
+ _.each(relations, function (key) {
+ attrs[key] = relations[key].toJSON();
+ });
+
+ return attrs;
+ }
}, {