Ghost/core/server/models/session.js
Sebastian Gierlinger ea6c601b01 Improvements for models
#closes #1655
- removed models as parameter for bookshelf-session
- changed to read permittedAttributes from schema.js
- changed updateTags to be executed at saved event
- added validate to execute after saving event
- added test for published_at = null (see #2015)
- fixed typo in general.hbs
2014-02-19 14:57:26 +01:00

27 lines
551 B
JavaScript

var ghostBookshelf = require('./base'),
Session,
Sessions;
Session = ghostBookshelf.Model.extend({
tableName: 'sessions'
}, {
destroyAll: function (options) {
options = options || {};
return ghostBookshelf.Collection.forge([], {model: this}).fetch().
then(function (collection) {
collection.invokeThen('destroy', options);
});
}
});
Sessions = ghostBookshelf.Collection.extend({
model: Session
});
module.exports = {
Session: Session,
Sessions: Sessions
};