mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 09:52:06 +03:00
b03ecd9ebc
Refs #2170 This removes the circular dependency problem from our models thanks to https://github.com/tgriesser/bookshelf/issues/181 - add the registry plugin - switch all models and collections to be registered - switch relationships to be defined using a string, which calls from the registry
20 lines
443 B
JavaScript
20 lines
443 B
JavaScript
var ghostBookshelf = require('./base'),
|
|
AppField,
|
|
AppFields;
|
|
|
|
AppField = ghostBookshelf.Model.extend({
|
|
tableName: 'app_fields',
|
|
|
|
post: function () {
|
|
return this.morphOne('Post', 'relatable');
|
|
}
|
|
});
|
|
|
|
AppFields = ghostBookshelf.Collection.extend({
|
|
model: AppField
|
|
});
|
|
|
|
module.exports = {
|
|
AppField: ghostBookshelf.model('AppField', AppField),
|
|
AppFields: ghostBookshelf.collection('AppFields', AppFields)
|
|
}; |