in locals middleware require tavern and mods only once

This commit is contained in:
Matteo Pagliazzi
2015-08-14 13:10:53 +02:00
parent fbeeb18923
commit 34dd4494ec
2 changed files with 7 additions and 2 deletions

View File

@@ -577,6 +577,10 @@ UserSchema.methods.unlink = function(options, cb) {
module.exports.schema = UserSchema;
module.exports.model = mongoose.model("User", UserSchema);
// Initially export an empty object so external requires will get
// the right object by reference when it's defined later
// Otherwise it would remain undefined if requested before the query executes
module.exports.mods = {};
mongoose.model("User")
.find({'contributor.admin':true})