Association auto population is sexy during the early stages of the app development. Soon as the related models result in high number of associated records the api calls get a drastic performance hit. SailsJS provides a way to toggle this globally.
module.exports.blueprints.populate = true / false;
Ideal application would be to disable this option globally and load the related models on demand , is this possible ( Base use case would be how Laravel does things with Eager loading http://laravel.com/docs/5.0/eloquent#eager-loading ).
You should be able to override the blueprint configuration per controller #/disabling-blueprints-on-a-per-controller-basis
You may also override any of the settings from config/blueprints.js on a per-controller basis by defining a '_config' key in your controller defintion, and assigning it a configuration object with overrides for the settings in this file.
Try this in the controller where you want to activate populate:
module.exports = {
_config: {
populate: true
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.